Module: Ki::Helpers
Instance Method Summary
collapse
#view_exists?, #view_path
Instance Method Details
#css(url) ⇒ Object
43
44
45
|
# File 'lib/ki/helpers.rb', line 43
def css url
render_haml "%link{:href => '#{url}', :rel => 'stylesheet'}"
end
|
#js(url) ⇒ Object
47
48
49
|
# File 'lib/ki/helpers.rb', line 47
def js url
render_haml "%script{:src => '#{url}'}"
end
|
#partial(s) ⇒ Object
55
56
57
58
59
60
61
62
|
# File 'lib/ki/helpers.rb', line 55
def partial s
path = view_path(s)
if File.file?(path)
render_haml(File.read(path))
else
raise PartialNotFoundError.new path
end
end
|
#render_haml(s) ⇒ Object
51
52
53
|
# File 'lib/ki/helpers.rb', line 51
def render_haml s
Haml::Engine.new(s).render
end
|