Class: Dependencies::RootLoadingModule

Inherits:
LoadingModule show all
Defined in:
lib/active_support/dependencies.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from LoadingModule

#const_available?, #const_load!, #const_missing, root, #root?

Methods inherited from Module

#mattr_accessor, #mattr_reader, #mattr_writer

Constructor Details

#initialize(*paths) ⇒ RootLoadingModule

Returns a new instance of RootLoadingModule.



113
114
115
# File 'lib/active_support/dependencies.rb', line 113

def initialize(*paths)
  @load_paths = paths.flatten.collect {|p| p.kind_of?(ConstantLoadPath) ? p : ConstantLoadPath.new(p)}
end

Instance Attribute Details

#load_pathsObject (readonly)

Returns the value of attribute load_paths.



111
112
113
# File 'lib/active_support/dependencies.rb', line 111

def load_paths
  @load_paths
end

Instance Method Details

#clear!Object

Erase all items in this module



127
128
129
130
131
132
# File 'lib/active_support/dependencies.rb', line 127

def clear!
  constants.each do |name|
    Object.send(:remove_const, name) if Object.const_defined?(name) && Object.const_get(name).object_id == self.const_get(name).object_id
    self.send(:remove_const, name)
  end
end

#load_file!(file_path) ⇒ Object

Load the source file at the given file path



122
123
124
# File 'lib/active_support/dependencies.rb', line 122

def load_file!(file_path)
  require_dependency(file_path)
end

#pathObject



119
# File 'lib/active_support/dependencies.rb', line 119

def path() [] end

#rootObject



117
# File 'lib/active_support/dependencies.rb', line 117

def root() self end