Class: Consyncful::Stats
- Inherits:
-
Object
- Object
- Consyncful::Stats
- Defined in:
- lib/consyncful/stats.rb
Instance Method Summary collapse
-
#initialize ⇒ Stats
constructor
A new instance of Stats.
- #print_stats ⇒ Object
- #record_added ⇒ Object
- #record_deleted ⇒ Object
- #record_updated ⇒ Object
Constructor Details
#initialize ⇒ Stats
Returns a new instance of Stats.
7 8 9 10 11 12 13 |
# File 'lib/consyncful/stats.rb', line 7 def initialize @stats = { records_added: 0, records_updated: 0, records_deleted: 0 } end |
Instance Method Details
#print_stats ⇒ Object
27 28 29 30 31 |
# File 'lib/consyncful/stats.rb', line 27 def print_stats puts Rainbow("Added: #{@stats[:records_added]}, \ updated: #{@stats[:records_updated]}, \ deleted: #{@stats[:records_deleted]}").blue end |
#record_added ⇒ Object
15 16 17 |
# File 'lib/consyncful/stats.rb', line 15 def record_added @stats[:records_added] += 1 end |
#record_deleted ⇒ Object
23 24 25 |
# File 'lib/consyncful/stats.rb', line 23 def record_deleted @stats[:records_deleted] += 1 end |
#record_updated ⇒ Object
19 20 21 |
# File 'lib/consyncful/stats.rb', line 19 def record_updated @stats[:records_updated] += 1 end |