class Rails::Paths::Root

Check the Rails::Paths::Path documentation for more information.<br><br>root.existent # => [“/rails/app/controllers”]<br>root.expanded # => [“/rails/app/controllers”]
root.add “app/controllers”
root = Root.new “/rails”
Finally, the Path object also provides a few helpers:
eager_load, autoload, autoload_once, and glob.
The add method accepts the following options as arguments:<br><br>root.inspect # => [“config/routes.rb”]
root.add “config/routes”, with: “config/routes.rb”
you may not want this behavior, so you can give :with as option.
contains the path with the same path value given to add. In some situations,
Notice that when you add a path using add, the path object created already
path.to_ary.inspect # => [“app/controllers”, “lib/controllers”]
path << “lib/controllers”
path.to_ary.inspect # => [“app/controllers”]
path.is_a?(Enumerable) # => true
The Path object is simply an enumerable and allows you to easily add extra paths:
path.is_a?(Rails::Paths::Path) # => true
path.eager_load? # => true
path = root[“app/controllers”]

This means we can get a Rails::Paths::Path object back like below:
The above command creates a new root object and adds “app/controllers” as a path.
root.add “app/controllers”, eager_load: true
root = Root.new “/rails”
paths through a Hash-like API. It requires you to give a physical path on initialization.
It allows you to collect information about how you want to structure your application
This object is an extended hash that behaves as root of the Rails::Paths system.

def [](path)

def [](path)
  @root[path]
end

def []=(path, value)

def []=(path, value)
  glob = self[path] ? self[path].glob : nil
  add(path, with: value, glob: glob)
end

def add(path, options = {})

def add(path, options = {})
  with = Array(options.fetch(:with, path))
  @root[path] = Path.new(self, path, with, options)
end

def all_paths

def all_paths
  values.tap(&:uniq!)
end

def autoload_once

def autoload_once
  filter_by(&:autoload_once?)
end

def autoload_paths

def autoload_paths
  filter_by(&:autoload?)
end

def eager_load

def eager_load
  filter_by(&:eager_load?)
end

def filter_by(&block)

def filter_by(&block)
  all_paths.find_all(&block).flat_map { |path|
    paths = path.existent
    paths - path.children.flat_map { |p| yield(p) ? [] : p.existent }
  }.uniq
end

def initialize(path)

def initialize(path)
  @path = path
  @root = {}
end

def keys

def keys
  @root.keys
end

def load_paths

def load_paths
  filter_by(&:load_path?)
end

def values

def values
  @root.values
end

def values_at(*list)

def values_at(*list)
  @root.values_at(*list)
end