Class: Eternity::Tracker
- Inherits:
-
Object
- Object
- Eternity::Tracker
- Extended by:
- Forwardable
- Defined in:
- lib/eternity/tracker.rb
Constant Summary collapse
- Changes =
Restruct::NestedHash.new CollectionTracker
Instance Attribute Summary collapse
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
- #count ⇒ Object
- #flatten ⇒ Object
-
#initialize(repository) ⇒ Tracker
constructor
A new instance of Tracker.
Constructor Details
Instance Attribute Details
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
9 10 11 |
# File 'lib/eternity/tracker.rb', line 9 def repository @repository end |
Instance Method Details
#count ⇒ Object
17 18 19 20 21 |
# File 'lib/eternity/tracker.rb', line 17 def count changes.inject(0) do |sum, (collection, tracker)| sum + tracker.count end end |
#flatten ⇒ Object
26 27 28 29 30 31 |
# File 'lib/eternity/tracker.rb', line 26 def flatten changes.each_with_object({}) do |(collection, tracker), hash| collection_changes = tracker.flatten hash[collection] = collection_changes unless collection_changes.empty? end end |