Class: Command::RestOfLineArgument
- Inherits:
-
StringArgument
- Object
- Argument
- StringArgument
- Command::RestOfLineArgument
- Defined in:
- lib/command-set/arguments.rb
Overview
Consumes the rest of the line as a space separated string. Useful for commands with sentences as their arguments.
Instance Attribute Summary
Attributes inherited from Argument
Instance Method Summary collapse
Methods inherited from StringArgument
#complete, #initialize, #validate
Methods inherited from Argument
#check_present, #complete, #consume_hash, #initialize, #match_terms, #omittable?, #parse, register, #required?, #validate
Constructor Details
This class inherits a constructor from Command::StringArgument
Instance Method Details
#consume(subject, arguments) ⇒ Object
356 357 358 359 360 361 362 363 |
# File 'lib/command-set/arguments.rb', line 356 def consume(subject, arguments) term = arguments.join(" ") arguments.clear unless validate(term, subject) raise ArgumentInvalidException, {@name => term} end return {@name => parse(subject, term)} end |