Class: Hanami::View::Path Private
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #dir ⇒ Object readonly private
- #root ⇒ Object readonly private
Class Method Summary collapse
- .[](path) ⇒ Object private
Instance Method Summary collapse
- #chdir(dirname) ⇒ Object private
-
#initialize(dir, root: dir) ⇒ Path
constructor
private
A new instance of Path.
-
#lookup(prefix, name, format) ⇒ Object
private
Searches for a template using a wildcard for the engine extension.
- #to_s ⇒ Object private
Constructor Details
#initialize(dir, root: dir) ⇒ Path
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Path.
28 29 30 31 |
# File 'lib/hanami/view/path.rb', line 28 def initialize(dir, root: dir) @dir = Pathname(dir) @root = Pathname(root) end |
Instance Attribute Details
#dir ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/hanami/view/path.rb', line 14 def dir @dir end |
Class Method Details
.[](path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 21 22 23 24 |
# File 'lib/hanami/view/path.rb', line 18 def self.[](path) if path.is_a?(self) path else new(path) end end |
Instance Method Details
#chdir(dirname) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
44 45 46 |
# File 'lib/hanami/view/path.rb', line 44 def chdir(dirname) self.class.new(dir.join(dirname), root: root) end |
#lookup(prefix, name, format) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Searches for a template using a wildcard for the engine extension
37 38 39 40 |
# File 'lib/hanami/view/path.rb', line 37 def lookup(prefix, name, format) glob = dir.join(prefix, "#{name}.#{format}.*") Dir[glob].first end |
#to_s ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
50 51 52 |
# File 'lib/hanami/view/path.rb', line 50 def to_s dir.to_s end |