Module: Wunderbar::SinatraHelpers
- Defined in:
- lib/wunderbar/sinatra.rb
Instance Method Summary collapse
- #_html(*args, &block) ⇒ Object
- #_json(*args, &block) ⇒ Object
- #_text(*args, &block) ⇒ Object
- #_xhtml(*args, &block) ⇒ Object
Instance Method Details
#_html(*args, &block) ⇒ Object
132 133 134 135 136 137 138 139 140 |
# File 'lib/wunderbar/sinatra.rb', line 132 def _html(*args, &block) if block Wunderbar::Template::Html.evaluate('_html', self) do _html(*args) { instance_eval &block } end else Wunderbar::Template::Html.evaluate('_html', self, *args) end end |
#_json(*args, &block) ⇒ Object
156 157 158 |
# File 'lib/wunderbar/sinatra.rb', line 156 def _json(*args, &block) Wunderbar::Template::Json.evaluate('_json', self, *args, &block) end |
#_text(*args, &block) ⇒ Object
160 161 162 |
# File 'lib/wunderbar/sinatra.rb', line 160 def _text(*args, &block) Wunderbar::Template::Text.evaluate('_text', self, *args, &block) end |
#_xhtml(*args, &block) ⇒ Object
142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/wunderbar/sinatra.rb', line 142 def _xhtml(*args, &block) if env['HTTP_ACCEPT'] and not env['HTTP_ACCEPT'].include? 'xhtml' return _html(*args, &block) end if block Wunderbar::Template::Xhtml.evaluate('_xhtml', self) do _xhtml(*args) { instance_eval &block } end else Wunderbar::Template::Xhtml.evaluate('_xhtml', self, *args) end end |