Class Boson::Namespace

  1. lib/boson/namespace.rb
Parent: Object

Used in all things namespace.

Methods

public class

  1. create
  2. namespaces
  3. new

public instance

  1. boson_commands
  2. method_missing

Public class methods

create (name, library)

Creates a namespace given its name and the library it belongs to.

[show source]
# File lib/boson/namespace.rb, line 10
    def self.create(name, library)
      namespaces[name.to_s] = new(name, library)
      Commands::Namespace.send(:define_method, name) { Boson::Namespace.namespaces[name.to_s] }
    end
namespaces ()

Hash of created namespace names to namespace objects

[show source]
# File lib/boson/namespace.rb, line 5
    def self.namespaces
      @namespaces ||= {}
    end
new (name, library)
[show source]
# File lib/boson/namespace.rb, line 15
    def initialize(name, library)
      raise ArgumentError unless library.module
      @name, @library = name.to_s, library
      class <<self; self end.send :include, @library.module
    end

Public instance methods

boson_commands ()

List of subcommands for the namespace.

[show source]
# File lib/boson/namespace.rb, line 27
    def boson_commands
      @library.module.instance_methods.map {|e| e.to_s }
    end
method_missing (method, *args, &block)
[show source]
# File lib/boson/namespace.rb, line 21
    def method_missing(method, *args, &block)
      Boson.can_invoke?(method) ? Boson.invoke(method, *args, &block) : super
    end