Class: ActionView::OutputBuffer
- Inherits:
-
Object
- Object
- ActionView::OutputBuffer
- Defined in:
- lib/kaizan.rb
Instance Attribute Summary collapse
-
#altering_anchor ⇒ Object
Returns the value of attribute altering_anchor.
-
#anonymous_anchor ⇒ Object
Returns the value of attribute anonymous_anchor.
Instance Method Summary collapse
- #alter_past!(name, content) ⇒ Object
- #alter_string_safety(content) ⇒ Object
-
#initialize ⇒ OutputBuffer
constructor
A new instance of OutputBuffer.
- #register_anchor(name = nil) ⇒ Object
Constructor Details
#initialize ⇒ OutputBuffer
Returns a new instance of OutputBuffer.
26 27 28 29 30 31 |
# File 'lib/kaizan.rb', line 26 def initialize(*) super self.altering_anchor = {} self.anonymous_anchor = [] end |
Instance Attribute Details
#altering_anchor ⇒ Object
Returns the value of attribute altering_anchor.
23 24 25 |
# File 'lib/kaizan.rb', line 23 def altering_anchor @altering_anchor end |
#anonymous_anchor ⇒ Object
Returns the value of attribute anonymous_anchor.
23 24 25 |
# File 'lib/kaizan.rb', line 23 def anonymous_anchor @anonymous_anchor end |
Instance Method Details
#alter_past!(name, content) ⇒ Object
34 35 36 37 |
# File 'lib/kaizan.rb', line 34 def alter_past!(name, content) return unless (anchor = detect_anchor(name)).present? gsub_not_safety!(anchor, alter_string_safety(content)) end |
#alter_string_safety(content) ⇒ Object
40 41 42 |
# File 'lib/kaizan.rb', line 40 def alter_string_safety(content) content.html_safe? ? content.to_s : html_escape_interpolated_argument_force(content.to_s) end |
#register_anchor(name = nil) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/kaizan.rb', line 45 def register_anchor(name = nil) generate_anchor(name).tap { |anchor| anonymous_anchor.push(anchor) altering_anchor[name] = anchor if name.present? }.html_safe end |