Class: Hanami::Utils::LoadPaths
- Defined in:
- gems/gems/hanami-utils-2.2.0.beta1/lib/hanami/utils/load_paths.rb
Overview
A collection of loading paths.
Instance Method Summary collapse
-
#each {|pathname| ... } ⇒ void
Iterates through the collection and yields the given block.
-
#freeze ⇒ Object
It freezes the object by preventing further modifications.
-
#initialize(*paths) ⇒ Hanami::Utils::LoadPaths
constructor
Initialize a new collection for the given paths.
-
#push(*paths) ⇒ Hanami::Utils::LoadPaths
(also: #<<)
Adds the given path(s).
Constructor Details
#initialize(*paths) ⇒ Hanami::Utils::LoadPaths
Initialize a new collection for the given paths
Instance Method Details
#each {|pathname| ... } ⇒ void
This method returns an undefined value.
Iterates through the collection and yields the given block. It skips duplications and raises an error in case one of the paths doesn’t exist.
Source: | on GitHub
def each @paths.each do |path| yield realpath(path) end end |
#freeze ⇒ Object
It freezes the object by preventing further modifications.
Source: | on GitHub
def freeze super @paths.freeze end |
#push(*paths) ⇒ Hanami::Utils::LoadPaths Also known as: <<
Adds the given path(s).
It returns self, so that multiple operations can be performed.