class Hanami::View::Path

@api private @since 2.1.0

Attributes

dir[R]

@api private @since 2.1.0

root[R]

@api private @since 2.1.0

Public Class Methods

[](path) click to toggle source

@api private @since 2.1.0

# File lib/hanami/view/path.rb, line 18
def self.[](path)
  if path.is_a?(self)
    path
  else
    new(path)
  end
end
new(dir, root: dir) click to toggle source

@api private @since 2.1.0

# File lib/hanami/view/path.rb, line 28
def initialize(dir, root: dir)
  @dir = Pathname(dir)
  @root = Pathname(root)
end

Public Instance Methods

chdir(dirname) click to toggle source

@api private @since 2.1.0

# File lib/hanami/view/path.rb, line 44
def chdir(dirname)
  self.class.new(dir.join(dirname), root: root)
end
lookup(prefix, name, format) click to toggle source

Searches for a template using a wildcard for the engine extension

@api private @since 2.1.0

# 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() click to toggle source

@api private @since 2.1.0

# File lib/hanami/view/path.rb, line 50
def to_s
  dir.to_s
end