Sha256: fec756d78825665cfe445c8f640fa560cf3bb1a1eae048a7e12368abd1631227

Contents?: true

Size: 633 Bytes

Versions: 39

Compression:

Stored size: 633 Bytes

Contents

# frozen_string_literal: true

require_relative '../../models/entry_group'

module Dsu
  module Services
    module EntryGroup
      class CounterService
        def initialize(times:, options: {})
          raise ArgumentError, 'Argument times is nil' if times.nil?

          @times = times
          @options = options
        end

        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

        private

        attr_reader :times, :options
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
dsu-3.0.5 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.4 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.3 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.1 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.0 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.0.beta.3 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.0.beta.2 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.0.beta.1 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.0.beta.0 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.0.alpha.12 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.0.alpha.11 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.0.alpha.10 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.0.alpha.9 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.0.alpha.8 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.0.alpha.7 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.0.alpha.6 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.0.alpha.5 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.0.alpha.4 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.0.alpha.3 lib/dsu/services/entry_group/counter_service.rb
dsu-3.0.0.alpha.2 lib/dsu/services/entry_group/counter_service.rb