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.
450 451 452 |
# File 'lib/tiny.rb', line 450 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.
455 456 457 |
# File 'lib/tiny.rb', line 455 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.
444 445 446 |
# File 'lib/tiny.rb', line 444 def with_buffer(*args, &block) block_from_template?(block) ? capture(*args, &block) : super end |