Class: ActionText::PlainTextConversion::BottomUpReducer
- Inherits:
-
Object
- Object
- ActionText::PlainTextConversion::BottomUpReducer
- Defined in:
- lib/action_text/plain_text_conversion.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(node) ⇒ BottomUpReducer
constructor
A new instance of BottomUpReducer.
- #reduce(&block) ⇒ Object
Constructor Details
#initialize(node) ⇒ BottomUpReducer
Returns a new instance of BottomUpReducer.
127 128 129 130 |
# File 'lib/action_text/plain_text_conversion.rb', line 127 def initialize(node) @node = node @values = {} end |
Instance Method Details
#reduce(&block) ⇒ Object
132 133 134 135 136 137 138 |
# File 'lib/action_text/plain_text_conversion.rb', line 132 def reduce(&block) traverse_bottom_up(@node) do |n| child_values = @values.values_at(*n.children) @values[n] = block.call(n, child_values) end @values[@node] end |