Module: Boson::Library::LibrariesLoader

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

Overview

:object_methods

Boolean which detects any Object/Kernel methods created when loading a library and automatically adds them to a library’s commands. Default is true.

Instance Method Summary collapse

Instance Method Details

#after_includeObject



89
90
91
92
# File 'lib/boson/libraries.rb', line 89

def after_include
  @module.after_included if @module.respond_to?(:after_included) && !@index
  super
end

#before_load_commandsObject

Raises:

  • (LoaderError)


80
81
82
83
84
85
86
87
# File 'lib/boson/libraries.rb', line 80

def before_load_commands
  raise(LoaderError, "No module for library #{@name}") unless @module
  if (conflict = Util.top_level_class_conflict(Boson::Commands, @module.to_s))
    warn "Library module '#{@module}' may conflict with top level class/module '#{conflict}' references in"+
      " your libraries. Rename your module to avoid this warning."
  end
  super
end

#detect_additions(options = {}, &block) ⇒ Object



62
63
64
65
66
67
68
69
70
# File 'lib/boson/libraries.rb', line 62

def detect_additions(options={}, &block)
  options[:object_methods] = @object_methods if !@object_methods.nil?
  super(options, &block).tap do |detected|
    if detected[:gems]
      @gems ||= []
      @gems.concat detected[:gems]
    end
  end
end

#module_callbacksObject



72
73
74
75
76
77
78
# File 'lib/boson/libraries.rb', line 72

def module_callbacks
  set_config(@module.config) if @module.respond_to?(:config)
  if @module.respond_to?(:append_features)
    raise AppendFeaturesFalseError unless @module.append_features(Module.new)
  end
  super
end