Module: Ki::Helpers

Includes:
Middleware::Helpers::View
Defined in:
lib/ki/helpers.rb

Instance Method Summary collapse

Methods included from Middleware::Helpers::View

#view_exists?, #view_path

Instance Method Details

#css(url) ⇒ Object



7
8
9
# File 'lib/ki/helpers.rb', line 7

def css(url)
  haml "%link{:href => '#{url}', :rel => 'stylesheet'}"
end

#haml(s) ⇒ Object



15
16
17
# File 'lib/ki/helpers.rb', line 15

def haml(s)
  Haml::Engine.new(s).render
end

#js(url) ⇒ Object



11
12
13
# File 'lib/ki/helpers.rb', line 11

def js(url)
  haml "%script{:src => '#{url}'}"
end

#partial(s) ⇒ Object



19
20
21
22
23
# File 'lib/ki/helpers.rb', line 19

def partial(s)
  path = view_path(s)
  raise PartialNotFoundError, path unless File.file?(path)
  haml(File.read(path))
end