Class: TallyJobs::Configs

Inherits:
Object
  • Object
show all
Defined in:
lib/tally_jobs/configs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#intervalObject

Returns the value of attribute interval.



8
9
10
# File 'lib/tally_jobs/configs.rb', line 8

def interval
  @interval
end

#loggerObject

Returns the value of attribute logger.



8
9
10
# File 'lib/tally_jobs/configs.rb', line 8

def logger
  @logger
end

#redisObject

Returns the value of attribute redis.



8
9
10
# File 'lib/tally_jobs/configs.rb', line 8

def redis
  @redis
end

Instance Method Details

#counter_store=(store) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/tally_jobs/configs.rb', line 14

def counter_store=(store)
    JobsCounter.store = \
        case store
        when :memory_counter_store
            TallyJobs::CounterStore::MemoryCounterStore.new
        when Hash
            case store[:store]
            when :redis_counter_store
                TallyJobs::CounterStore::RedisCounterStore.new(**store.except(:store))
            else
                store.delete(:store).to_s.classify.constantize.new(**store)
            end
        else
            store.to_s.classify.constantize.new
        end
end