Class: Stamina::Command::Classify

Inherits:
Object
  • Object
show all
Includes:
Robustness
Defined in:
lib/stamina-induction/stamina/command/classify.rb

Overview

Classifies a sample thanks with an automaton

SYNOPSIS

#{program_name} #{command_name} sample.adl automaton.adl

OPTIONS #summarized_options

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#output_fileObject

Where to flush the output



16
17
18
# File 'lib/stamina-induction/stamina/command/classify.rb', line 16

def output_file
  @output_file
end

Instance Method Details

#execute(args) ⇒ Object

Command execution

Raises:

  • (Quickl::Help)


31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/stamina-induction/stamina/command/classify.rb', line 31

def execute(args)
  raise Quickl::Help unless args.size == 2
  sample    = Stamina::ADL::parse_sample_file assert_readable_file(args.first)
  automaton = Stamina::ADL::parse_automaton_file assert_readable_file(args.last)

  if of = output_file
    File.open(of, 'w'){|io|
      io << automaton.signature(sample)
    }
  else
    $stdout << automaton.signature(sample)
  end
end