Module: Boson::Library::NamespaceLoader

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#indexed_namespaceObject (readonly)

Returns the value of attribute indexed_namespace.



79
80
81
# File 'lib/boson/namespacer.rb', line 79

def indexed_namespace
  @indexed_namespace
end

#object_namespaceObject (readonly)

Returns the value of attribute object_namespace.



79
80
81
# File 'lib/boson/namespacer.rb', line 79

def object_namespace
  @object_namespace
end

Instance Method Details

#actual_load_commandsObject



92
93
94
95
# File 'lib/boson/namespacer.rb', line 92

def actual_load_commands
  @namespace = clean_name if @object_namespace
  namespace ? Namespace.create(namespace, self) : include_in_universe
end

#clean_library_commandsObject



103
104
105
106
107
# File 'lib/boson/namespacer.rb', line 103

def clean_library_commands
  @commands.delete(namespace) if namespace
  @commands += Boson.invoke(namespace).boson_commands if namespace && !@pre_defined_commands
  super
end

#handle_method_conflict_error(err) ⇒ Object



81
82
83
84
85
86
87
88
89
90
# File 'lib/boson/namespacer.rb', line 81

def handle_method_conflict_error(err)
  if Boson.config[:error_method_conflicts] || namespace
    raise err
  else
    @namespace = clean_name
    @method_conflict = true
    $stderr.puts "#{err.message}. Attempting load into the namespace #{@namespace}..."
    load_commands
  end
end

#method_conflictsObject



97
98
99
100
101
# File 'lib/boson/namespacer.rb', line 97

def method_conflicts
  namespace ?
    (Boson.can_invoke?(namespace) ?  [namespace] : []) :
    super
end

#set_library_commandsObject



109
110
111
112
113
# File 'lib/boson/namespacer.rb', line 109

def set_library_commands
  @namespace = false if !(@module || @class_commands)
  super
  @indexed_namespace = (@namespace == false) ? nil : @namespace if @index
end