Method: Command::CommandSet#root_visit

Defined in:
lib/command-set/command-set.rb

#root_visit(terms, visitor) ⇒ Object



229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/command-set/command-set.rb', line 229

def root_visit(terms, visitor)
  next_hop = if(terms.empty?)
               visitor.set_out_of_terms(self)
               @command_list[nil]
             elsif(visitor.command_path.empty?)
               @mode_commands[terms.first] || @command_list[terms.first]
             else
               @command_list[terms.first]
             end

  return visitor.term_without_hop(terms, self) if(next_hop.nil?)

  visitor.leave_from(terms.shift, terms, self)

  return next_hop.visit(terms, visitor)
end