Class: Tipsy::View::Path

Inherits:
Hike::Trail
  • Object
show all
Defined in:
lib/tipsy/view/path.rb

Instance Method Summary collapse

Constructor Details

#initializePath

Returns a new instance of Path.



7
8
9
10
11
# File 'lib/tipsy/view/path.rb', line 7

def initialize
  super(Tipsy.root)
  append_path('.')
  append_extensions '.erb','.html', '.json', '.xml', '.php'
end

Instance Method Details

#locate_layout(name) ⇒ Object



19
20
21
22
23
# File 'lib/tipsy/view/path.rb', line 19

def locate_layout(name)
  with_temporary_scope('layouts') do
    @_layout ||= find(name)
  end
end

#locate_relative(path, name) ⇒ Object



25
26
27
28
29
# File 'lib/tipsy/view/path.rb', line 25

def locate_relative(path, name)
  with_temporary_scope("views", path) do
    find(name)
  end
end

#locate_template(view_path) ⇒ Object



13
14
15
16
17
# File 'lib/tipsy/view/path.rb', line 13

def locate_template(view_path)
  with_temporary_scope('views') do
    @_template ||= (find(view_path) || find(File.join(view_path, "index")))
  end
end