Class: Rails::Paths::Root

Inherits:
Object
  • Object
show all
Includes:
PathParent
Defined in:
lib/rails/paths.rb

Instance Attribute Summary collapse

Attributes included from PathParent

#children

Instance Method Summary collapse

Methods included from PathParent

#method_missing

Constructor Details

#initialize(path) ⇒ Root

Returns a new instance of Root.



26
27
28
29
30
31
32
# File 'lib/rails/paths.rb', line 26

def initialize(path)
  raise if path.is_a?(Array)
  @children = {}
  @path = path
  @root = self
  @all_paths = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Rails::Paths::PathParent

Instance Attribute Details

#pathObject

Returns the value of attribute path.



24
25
26
# File 'lib/rails/paths.rb', line 24

def path
  @path
end

Instance Method Details

#all_pathsObject



34
35
36
37
# File 'lib/rails/paths.rb', line 34

def all_paths
  @all_paths.uniq!
  @all_paths
end

#autoload_onceObject



39
40
41
# File 'lib/rails/paths.rb', line 39

def autoload_once
  filter_by(:autoload_once?)
end

#autoload_pathsObject



47
48
49
# File 'lib/rails/paths.rb', line 47

def autoload_paths
  filter_by(:autoload?)
end

#eager_loadObject



43
44
45
# File 'lib/rails/paths.rb', line 43

def eager_load
  filter_by(:eager_load?)
end

#load_pathsObject



51
52
53
# File 'lib/rails/paths.rb', line 51

def load_paths
  filter_by(:load_path?)
end

#pushObject Also known as: unshift, <<, concat



55
56
57
# File 'lib/rails/paths.rb', line 55

def push(*)
  raise "Application root can only have one physical path"
end