Class: Lowkey::ParentMap
- Inherits:
-
Object
- Object
- Lowkey::ParentMap
- Defined in:
- lib/maps/parent_map.rb
Instance Method Summary collapse
- #[](node) ⇒ Object
-
#initialize(root_node:) ⇒ ParentMap
constructor
A new instance of ParentMap.
Constructor Details
#initialize(root_node:) ⇒ ParentMap
Returns a new instance of ParentMap.
5 6 7 8 9 10 |
# File 'lib/maps/parent_map.rb', line 5 def initialize(root_node:) @parent_map = {} @current_parent = nil map(root_node) end |
Instance Method Details
#[](node) ⇒ Object
12 13 14 |
# File 'lib/maps/parent_map.rb', line 12 def [](node) @parent_map[node] end |