Module: Serbea::Helpers
- Included in:
- Bridgetown::SerbeaView, ComponentRenderer
- Defined in:
- lib/serbea/helpers.rb
Instance Method Summary collapse
- #capture(obj = nil) ⇒ Object
- #h(input) ⇒ Object (also: #escape)
- #helper(name, &block) ⇒ Object
- #pipeline(context, value) ⇒ Object
Instance Method Details
#capture(obj = nil) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/serbea/helpers.rb', line 3 def capture(obj=nil) previous_buffer_state = @_erbout @_erbout = +"" result = obj ? yield(obj) : yield @_erbout = previous_buffer_state result.respond_to?(:html_safe) ? result.html_safe : result end |
#h(input) ⇒ Object Also known as: escape
20 21 22 |
# File 'lib/serbea/helpers.rb', line 20 def h(input) Erubi.h(input) end |
#helper(name, &block) ⇒ Object
16 17 18 |
# File 'lib/serbea/helpers.rb', line 16 def helper(name, &block) self.class.send(:define_method, name, &block) end |