Module: Wunderbar::SinatraHelpers

Defined in:
lib/wunderbar/polymer.rb,
lib/wunderbar/sinatra.rb

Instance Method Summary collapse

Instance Method Details

#_html(*args, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/wunderbar/sinatra.rb', line 13

def _html(*args, &block)
  Wunderbar::Template.locals(self, args)

  if block
    Wunderbar::Template::Html.evaluate('html.rb', self) do
      _html(*args) { instance_eval(&block) }
    end
  else
    Wunderbar::Template::Html.evaluate('html.rb', self, *args)
  end
end

#_polymer_element(*args, &block) ⇒ Object



50
51
52
53
54
# File 'lib/wunderbar/polymer.rb', line 50

def _polymer_element(*args, &block)
  Wunderbar::Template::Html.evaluate('_polymer_element', self) do
    _polymer_element(*args) { instance_eval(&block) }
  end
end

#_xhtml(*args, &block) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/wunderbar/sinatra.rb', line 25

def _xhtml(*args, &block)
  if env['HTTP_ACCEPT'] and not env['HTTP_ACCEPT'].include? 'xhtml'
    return _html(*args, &block)
  end

  Wunderbar::Template.locals(self, args)

  if block
    Wunderbar::Template::Xhtml.evaluate('xhtml.rb', self) do
      _xhtml(*args) { instance_eval(&block) }
    end
  else
    Wunderbar::Template::Xhtml.evaluate('xhtml.rb', self, *args)
  end
end