Class: Dsu::Services::EntryGroup::CounterService
- Inherits:
-
Object
- Object
- Dsu::Services::EntryGroup::CounterService
- Defined in:
- lib/dsu/services/entry_group/counter_service.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(times:, options: {}) ⇒ CounterService
constructor
A new instance of CounterService.
Constructor Details
#initialize(times:, options: {}) ⇒ CounterService
Returns a new instance of CounterService.
9 10 11 12 13 14 |
# File 'lib/dsu/services/entry_group/counter_service.rb', line 9 def initialize(times:, options: {}) raise ArgumentError, 'Argument times is nil' if times.nil? @times = times = end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/dsu/services/entry_group/counter_service.rb', line 16 def call total_entry_groups = 0 times.each do |time| total_entry_groups += 1 if Models::EntryGroup.exist?(time: time) end total_entry_groups end |