Module: Cell::Slim::Rails::Helpers
- Defined in:
- lib/cell/slim/rails.rb
Overview
include after AV helpers to override.
Instance Method Summary collapse
- #capture(*args) ⇒ Object
- #concat(string) ⇒ Object
- #content_tag_string(name, content, options, escape = true) ⇒ Object
- #form_tag_html(html_options) ⇒ Object
-
#form_tag_in_block(html_options, &block) ⇒ Object
From FormTagHelper.
- #form_tag_with_body(html_options, content) ⇒ Object
- #tag_options(options, escape = true) ⇒ Object
- #with_output_buffer(block_buffer = ViewModel::OutputBuffer.new) ⇒ Object
Instance Method Details
#capture(*args) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/cell/slim/rails.rb', line 17 def capture(*args) value = nil buffer = with_output_buffer { value = yield(*args) } return buffer.to_s if buffer.size > 0 value # this applies for "Beachparty" string-only statements. end |
#concat(string) ⇒ Object
48 49 50 51 |
# File 'lib/cell/slim/rails.rb', line 48 def concat(string) @output_buffer << string self end |
#content_tag_string(name, content, options, escape = true) ⇒ Object
44 45 46 |
# File 'lib/cell/slim/rails.rb', line 44 def content_tag_string(name, content, , escape=true) super(name, content, , false) end |
#form_tag_html(html_options) ⇒ Object
35 36 37 38 |
# File 'lib/cell/slim/rails.rb', line 35 def form_tag_html() = () "#{tag(:form, , true) + }" end |
#form_tag_in_block(html_options, &block) ⇒ Object
From FormTagHelper. why do they escape every possible string? why?
26 27 28 29 |
# File 'lib/cell/slim/rails.rb', line 26 def form_tag_in_block(, &block) content = capture(&block) form_tag_with_body(, content) end |
#form_tag_with_body(html_options, content) ⇒ Object
31 32 33 |
# File 'lib/cell/slim/rails.rb', line 31 def form_tag_with_body(, content) "#{form_tag_html()}" << content.to_s << "</form>" end |
#tag_options(options, escape = true) ⇒ Object
40 41 42 |
# File 'lib/cell/slim/rails.rb', line 40 def (, escape = true) super(, true) end |
#with_output_buffer(block_buffer = ViewModel::OutputBuffer.new) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/cell/slim/rails.rb', line 9 def with_output_buffer(block_buffer=ViewModel::OutputBuffer.new) @output_buffer, old_buffer = block_buffer, @output_buffer yield @output_buffer = old_buffer block_buffer end |