Module: Boson::Command::NamespacerClass

Included in:
Boson::Command
Defined in:
lib/boson/namespacer.rb

Instance Method Summary collapse

Instance Method Details

#find(command, commands = Boson.commands) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/boson/namespacer.rb', line 28

def find(command, commands=Boson.commands)
  if command.to_s.include?(NAMESPACE)
    command, subcommand = command.to_s.split(NAMESPACE, 2)
    commands.find {|current_command|
      [current_command.name, current_command.alias].include?(subcommand) &&
      current_command.library && (current_command.library.namespace == command)
    }
  else
    commands.find {|e| [e.name, e.alias].include?(command) && !e.namespace}
  end
end

#library_attributes(library) ⇒ Object



24
25
26
# File 'lib/boson/namespacer.rb', line 24

def library_attributes(library)
  super.update(namespace: library.namespace)
end