Module: Zena::Use::Rendering::ZafuMethods
- Defined in:
- lib/zena/use/rendering.rb
Overview
ControllerMethods
Instance Method Summary collapse
-
#r_cache ⇒ Object
<r:cache rebuild=‘true’ allow_query=‘p=1?’/> <r:cache rebuild=‘true’ allow_query=‘p=1?’/>.
- #r_headers ⇒ Object
- #r_not_found ⇒ Object
- #r_style ⇒ Object
Instance Method Details
#r_cache ⇒ Object
<r:cache rebuild=‘true’ allow_query=‘p=1?’/> <r:cache rebuild=‘true’ allow_query=‘p=1?’/>
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/zena/use/rendering.rb', line 379 def r_cache params_list = [] if re = @params[:allow_query] reg_test = %r{^#{re}$} params_list << ":allow_query => #{reg_test.inspect}" end if rebuild = @params[:rebuild] # TODO: implement "replace if changed (diff)" instead of cache removal if there is the rebuild # setting so that the cached timestamp does not change. params_list << ":rebuild => #{@params[:rebuild].inspect}" end if at = @params[:expire_at] params_list << ":rebuild => #{@params[:rebuild].inspect}" end out "<% set_caching(:allow_query => #{reg_test.inspect}, :rebuild => #{@params[:rebuild].inspect}) %>" rescue => err parser_error("Invalid regular expression (#{err.})") end |
#r_headers ⇒ Object
365 366 367 368 369 370 371 372 373 374 375 |
# File 'lib/zena/use/rendering.rb', line 365 def r_headers headers = [] @params.each do |k, v| headers << "#{k.to_s.inspect} => #{RubyLess.translate_string(self, v)}" end if headers.empty? out "" else out "<% set_headers(#{headers.join(', ')}) %>" end end |
#r_not_found ⇒ Object
406 407 408 |
# File 'lib/zena/use/rendering.rb', line 406 def r_not_found out "<% raise ActiveRecord::RecordNotFound %>" end |
#r_style ⇒ Object
400 401 402 403 404 |
# File 'lib/zena/use/rendering.rb', line 400 def r_style @markup.tag = 'style' @markup.set_param(:type, 'text/css') end |