Class: Command::RestOfLine

Inherits:
StringArgument
  • Object
show all
Defined in:
lib/regexp-bench/arguments.rb

Overview

This is a demonstration of how easy it is to extend arguments. Probably this class belongs in the main CommandSet, but 0.8.0 doesn’t have it yet, so it’s added here.

Instance Method Summary collapse

Instance Method Details

#consume(subject, arguments) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/regexp-bench/arguments.rb', line 10

def consume(subject, arguments)
  term = arguments.join(" ")
  arguments.clear
  unless validate(term, subject)
  raise ArgumentInvalidException, {@name => term}
  end
  return {@name => parse(subject, term)}
end