class Gush::Configuration

Attributes

concurrency[RW]
namespace[RW]
redis_url[RW]
ttl[RW]

Public Class Methods

from_json(json) click to toggle source
# File lib/gush/configuration.rb, line 5
def self.from_json(json)
  new(Gush::JSON.decode(json, symbolize_keys: true))
end
new(hash = {}) click to toggle source
# File lib/gush/configuration.rb, line 9
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

Public Instance Methods

gushfile() click to toggle source
# File lib/gush/configuration.rb, line 21
def gushfile
  @gushfile.realpath if @gushfile.exist?
end
gushfile=(path) click to toggle source
# File lib/gush/configuration.rb, line 17
def gushfile=(path)
  @gushfile = Pathname(path)
end
to_hash() click to toggle source
# File lib/gush/configuration.rb, line 25
def to_hash
  {
    concurrency: concurrency,
    namespace:   namespace,
    redis_url:   redis_url,
    ttl:         ttl
  }
end
to_json() click to toggle source
# File lib/gush/configuration.rb, line 34
def to_json
  Gush::JSON.encode(to_hash)
end