Class: Tdd::CommandLineParser
- Inherits:
-
Object
- Object
- Tdd::CommandLineParser
- Defined in:
- lib/tdd/command_line_parser.rb
Instance Attribute Summary collapse
-
#paths ⇒ Object
Returns the value of attribute paths.
-
#test_framework ⇒ Object
Returns the value of attribute test_framework.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ CommandLineParser
constructor
A new instance of CommandLineParser.
- #test_command ⇒ Object
Constructor Details
#initialize ⇒ CommandLineParser
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/tdd/command_line_parser.rb', line 9 def initialize pos = ARGV.index('--') if pos @paths = ARGV[0 ... pos] @test_args = ARGV[pos + 1 .. -1].join(' ') else @paths = [] @test_args = ARGV[0..-1].join(' ') end @test_file = @test_args.scan(/^.+.rb/).first glob_for_test_file_matches parse_all_files_mode parse_controller_mode parse_test_framework end |
Instance Attribute Details
#paths ⇒ Object
Returns the value of attribute paths.
7 8 9 |
# File 'lib/tdd/command_line_parser.rb', line 7 def paths @paths end |
#test_framework ⇒ Object
Returns the value of attribute test_framework.
7 8 9 |
# File 'lib/tdd/command_line_parser.rb', line 7 def test_framework @test_framework end |
Class Method Details
.parse ⇒ Object
2 3 4 5 |
# File 'lib/tdd/command_line_parser.rb', line 2 def self.parse parser = self.new [parser.paths.flatten, parser.test_command] end |
Instance Method Details
#test_command ⇒ Object
25 26 27 |
# File 'lib/tdd/command_line_parser.rb', line 25 def test_command "#{@test_framework} #{@test_args}" end |