Class: Dry::View::Path Private

Inherits:
Object
  • Object
show all
Extended by:
Core::Cache
Defined in:
lib/dry/view/path.rb

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

Class Method Summary collapse

Instance Method Summary collapse

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.



23
24
25
26
# File 'lib/dry/view/path.rb', line 23

def initialize(dir, root: dir)
  @dir = Pathname(dir)
  @root = Pathname(root)
end

Instance Attribute Details

#dirObject (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.



13
14
15
# File 'lib/dry/view/path.rb', line 13

def dir
  @dir
end

#rootObject (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.



13
14
15
# File 'lib/dry/view/path.rb', line 13

def root
  @root
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.



15
16
17
18
19
20
21
# File 'lib/dry/view/path.rb', line 15

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.



36
37
38
# File 'lib/dry/view/path.rb', line 36

def chdir(dirname)
  self.class.new(dir.join(dirname), root: root)
end

#lookup(name, format, child_dirs: [], parent_dir: false) ⇒ 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.



28
29
30
31
32
33
34
# File 'lib/dry/view/path.rb', line 28

def lookup(name, format, child_dirs: [], parent_dir: false)
  fetch_or_store(dir, root, name, format, child_dirs, parent_dir) do
    lookup_template(name, format) ||
      lookup_in_child_dirs(name, format, child_dirs: child_dirs) ||
      parent_dir && lookup_in_parent_dir(name, format, child_dirs: child_dirs)
  end
end

#to_sObject

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.



40
41
42
# File 'lib/dry/view/path.rb', line 40

def to_s
  dir.to_s
end