Class: Command::CommandFinder

Inherits:
SetVisitor show all
Defined in:
lib/command-set/structural.rb

Instance Attribute Summary collapse

Attributes inherited from SetVisitor

#command_path, #subject_context

Instance Method Summary collapse

Methods inherited from SetVisitor

#arrive_at, #leave_from

Constructor Details

#initializeCommandFinder

Returns a new instance of CommandFinder.



49
50
51
52
# File 'lib/command-set/structural.rb', line 49

def initialize
  super()
  @command = nil
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



54
55
56
# File 'lib/command-set/structural.rb', line 54

def command
  @command
end

Instance Method Details

#command_out_of_terms(node) ⇒ Object



60
61
62
# File 'lib/command-set/structural.rb', line 60

def command_out_of_terms(node)
  @command ||= node
end

#extra_terms(terms, node) ⇒ Object



64
65
66
# File 'lib/command-set/structural.rb', line 64

def extra_terms(terms, node)
  term_without_hop(terms, node)
end

#set_out_of_terms(node) ⇒ Object



56
57
58
# File 'lib/command-set/structural.rb', line 56

def set_out_of_terms(node)
  @command ||= node
end

#term_without_hop(terms, node) ⇒ Object

Raises:



68
69
70
# File 'lib/command-set/structural.rb', line 68

def term_without_hop(terms, node)
  raise CommandException, "#{@command_path.join(" ")}: No such command #{terms.first}"
end