Module: Command::Common

Included in:
Command, CommandSet
Defined in:
lib/command-set/structural.rb

Instance Method Summary collapse

Instance Method Details

#add_requirements(subject) ⇒ Object



173
174
175
176
# File 'lib/command-set/structural.rb', line 173

def add_requirements(subject)
  each_command([], RequirementsCollector.new(subject))
  return subject
end

#completion_list(terms, prefix, subject) ⇒ Object



191
192
193
194
195
# File 'lib/command-set/structural.rb', line 191

def completion_list(terms, prefix, subject)
  visitor = CompletionsLister.new(prefix, subject, terms)
  visit(terms, visitor)
  return visitor.completion_list
end

#find_command(path) ⇒ Object



178
179
180
181
182
# File 'lib/command-set/structural.rb', line 178

def find_command(path)
  visitor = CommandFinder.new
  visit(path, visitor)
  return visitor.command
end

#pathObject



165
166
167
168
169
170
171
# File 'lib/command-set/structural.rb', line 165

def path
  if @parent.nil?
    return []
  else
    return @parent.path + [@name]
  end
end

#process_terms(terms, subject) ⇒ Object



184
185
186
187
188
189
# File 'lib/command-set/structural.rb', line 184

def process_terms(terms, subject)
  visitor = CommandSetup.new(terms)
  visitor.subject = subject
  root_visit(terms, visitor)
  return visitor
end