Class: Hydrangea::NodesByValue
- Defined in:
- lib/hydrangea/nodes_by_value.rb
Instance Method Summary collapse
-
#initialize(transform) ⇒ NodesByValue
constructor
A new instance of NodesByValue.
- #nodes ⇒ Object
Methods inherited from ManyNodes
Constructor Details
#initialize(transform) ⇒ NodesByValue
Returns a new instance of NodesByValue.
5 6 7 8 |
# File 'lib/hydrangea/nodes_by_value.rb', line 5 def initialize(transform) @transform = transform @nodes = transform.untransformed.reduce({}) { |h,n| h[n.value] = n; h } end |
Instance Method Details
#nodes ⇒ Object
10 11 12 |
# File 'lib/hydrangea/nodes_by_value.rb', line 10 def nodes map(&:last) end |