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?’/>
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
# File 'lib/zena/use/rendering.rb', line 376 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
362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/zena/use/rendering.rb', line 362 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
403 404 405 |
# File 'lib/zena/use/rendering.rb', line 403 def r_not_found out "<% raise ActiveRecord::RecordNotFound %>" end |
#r_style ⇒ Object
397 398 399 400 401 |
# File 'lib/zena/use/rendering.rb', line 397 def r_style @markup.tag = 'style' @markup.set_param(:type, 'text/css') end |