Class: Nuva::ValenceRepository
- Inherits:
-
Repository
- Object
- Repository
- Nuva::ValenceRepository
- Defined in:
- lib/nuva/repositories/valence_repository.rb
Instance Attribute Summary
Attributes inherited from Repository
Instance Method Summary collapse
- #get_ancestor_ids(valence_id) ⇒ Object
-
#initialize(data) ⇒ ValenceRepository
constructor
A new instance of ValenceRepository.
Methods inherited from Repository
Constructor Details
#initialize(data) ⇒ ValenceRepository
Returns a new instance of ValenceRepository.
5 6 7 8 9 10 11 12 13 |
# File 'lib/nuva/repositories/valence_repository.rb', line 5 def initialize(data) super data @ancestor_ids_by_id = {} @data.each_value do |valence| # Build hash of ancestor IDs for valence @ancestor_ids_by_id[valence.id] = lookup_ancestors(valence).uniq end @ancestor_ids_by_id.freeze end |
Instance Method Details
#get_ancestor_ids(valence_id) ⇒ Object
15 16 17 |
# File 'lib/nuva/repositories/valence_repository.rb', line 15 def get_ancestor_ids(valence_id) @ancestor_ids_by_id[valence_id] end |