Module: Tiny::ActionViewAdditions
Instance Method Summary collapse
-
#append(markup) ⇒ Object
Appends sanitized text to the content.
-
#block_from_template?(block) ⇒ Boolean
Returns true if the block was originated in an ERB or HAML template.
-
#with_buffer(*args) {|*args| ... } ⇒ String
Extracts a section of a template or buffers a block not originated from an template.
Methods included from Markup
#cdata, #comment, #doctype, #html_tag
Methods included from Buffering
Instance Method Details
#append(markup) ⇒ Object
Appends sanitized text to the content.
449 450 451 |
# File 'lib/tiny.rb', line 449 def append markup super(markup).html_safe end |
#block_from_template?(block) ⇒ Boolean
Returns true if the block was originated in an ERB or HAML template.
454 455 456 |
# File 'lib/tiny.rb', line 454 def block_from_template? block block && eval('defined?(output_buffer)', block.binding) == 'local-variable' end |
#with_buffer(*args) {|*args| ... } ⇒ String
Extracts a section of a template or buffers a block not originated from an template.
443 444 445 |
# File 'lib/tiny.rb', line 443 def with_buffer *args, &block block_from_template?(block) ? capture(*args, &block) : super end |