Sha256: 24454b4898c05be189a49a6543e8065b2bfe522e171bf01af2e37210932b987c
Contents?: true
Size: 886 Bytes
Versions: 5
Compression:
Stored size: 886 Bytes
Contents
module Gush class Configuration attr_accessor :concurrency, :namespace, :redis_url, :ttl def self.from_json(json) new(Gush::JSON.decode(json, symbolize_keys: true)) end def initialize(hash = {}) self.concurrency = hash.fetch(:concurrency, 5) self.namespace = hash.fetch(:namespace, 'gush') self.redis_url = hash.fetch(:redis_url, 'redis://localhost:6379') self.gushfile = hash.fetch(:gushfile, 'Gushfile') self.ttl = hash.fetch(:ttl, -1) end def gushfile=(path) @gushfile = Pathname(path) end def gushfile @gushfile.realpath if @gushfile.exist? end def to_hash { concurrency: concurrency, namespace: namespace, redis_url: redis_url, ttl: ttl } end def to_json Gush::JSON.encode(to_hash) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
gush-2.0.2 | lib/gush/configuration.rb |
gush-2.0.1 | lib/gush/configuration.rb |
gush-2.0.0 | lib/gush/configuration.rb |
gush-1.1.1 | lib/gush/configuration.rb |
gush-1.1.0 | lib/gush/configuration.rb |