Module: TestConsole::CliParser::Parsers
- Included in:
- TestConsole::CliParser
- Defined in:
- lib/test_console/cli_parser.rb
Instance Method Summary collapse
-
#command(line) ⇒ Object
parses the command section of a line of user input.
-
#file(line) ⇒ Object
parses the file component of a line of user input.
-
#filter(line) ⇒ Object
parses the filter component of a line of input.
Instance Method Details
#command(line) ⇒ Object
parses the command section of a line of user input
13 14 15 |
# File 'lib/test_console/cli_parser.rb', line 13 def command(line) line.split(' ')[0] end |
#file(line) ⇒ Object
parses the file component of a line of user input
18 19 20 21 22 23 |
# File 'lib/test_console/cli_parser.rb', line 18 def file(line) begin line.split(' ')[1] rescue end end |
#filter(line) ⇒ Object
parses the filter component of a line of input
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/test_console/cli_parser.rb', line 26 def filter(line) begin filter_str = line.split(' ')[2..-1].join(' ') filter = eval filter_str filter = "/#{filter_str}/" unless filter.kind_of?(Regexp) || filter_str.nil? || filter_str.empty? return filter rescue /#{filter_str}/ unless filter_str.nil? || filter_str.empty? end end |