Class: Fat::CommandLineFixture
- Inherits:
-
Fit::ColumnFixture
- Object
- Fit::Fixture
- Fit::ColumnFixture
- Fat::CommandLineFixture
- Defined in:
- lib/fat/command_line_fixture.rb
Overview
This is really testing OptionParser rather than some new RubyFIT code, but it’s nice to have anyway just in case the Ruby standard library behaviour should change between subsequent versions.
Constant Summary
Constants inherited from Fit::Fixture
Fit::Fixture::GRAY, Fit::Fixture::GREEN, Fit::Fixture::RED, Fit::Fixture::YELLOW
Instance Attribute Summary collapse
-
#command_line ⇒ Object
Returns the value of attribute command_line.
-
#encoding ⇒ Object
readonly
Returns the value of attribute encoding.
Attributes inherited from Fit::Fixture
Instance Method Summary collapse
- #args ⇒ Object
-
#initialize ⇒ CommandLineFixture
constructor
A new instance of CommandLineFixture.
- #input_file ⇒ Object
- #output_file ⇒ Object
Methods inherited from Fit::ColumnFixture
#check, #do_cell, #do_row, #do_rows, #execute, #reset
Methods inherited from Fit::Fixture
camel, #check, #do_cell, #do_cells, #do_row, #do_rows, #do_table, #do_tables, #error, escape, #exception, #find_class, #fixture_name, #get_args_for_table, #get_linked_fixture_with_args, gray, #ignore, #info, #interpret_following_tables, #interpret_tables, label, metadata, #parse, #right, #total_errors, #totals, #wrong
Constructor Details
#initialize ⇒ CommandLineFixture
Returns a new instance of CommandLineFixture.
17 18 19 20 |
# File 'lib/fat/command_line_fixture.rb', line 17 def initialize @options = OptionParser.new @options.on('--encoding=ENC') { |enc| @encoding = enc } end |
Instance Attribute Details
#command_line ⇒ Object
Returns the value of attribute command_line.
15 16 17 |
# File 'lib/fat/command_line_fixture.rb', line 15 def command_line @command_line end |
#encoding ⇒ Object (readonly)
Returns the value of attribute encoding.
16 17 18 |
# File 'lib/fat/command_line_fixture.rb', line 16 def encoding @encoding end |
Instance Method Details
#args ⇒ Object
27 28 29 30 |
# File 'lib/fat/command_line_fixture.rb', line 27 def args @encoding = 'Implementation-specific' @options.parse(command_line.split) end |
#input_file ⇒ Object
21 22 23 |
# File 'lib/fat/command_line_fixture.rb', line 21 def input_file args()[0] end |
#output_file ⇒ Object
24 25 26 |
# File 'lib/fat/command_line_fixture.rb', line 24 def output_file args()[1] end |