class Gush::Configuration

Attributes

concurrency[RW]
environment[RW]
namespace[RW]
redis_prefix[RW]
redis_url[RW]
sidekiq_options[RW]
sidekiq_queue[RW]

Public Class Methods

from_json(json) click to toggle source
# File lib/gush/configuration.rb, line 6
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 10
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.redis_prefix   = hash.fetch(:redis_prefix, 'gush')
  self.sidekiq_queue   = hash.fetch(:sidekiq_queue, 'gush')
  self.gushfile    = hash.fetch(:gushfile, 'Gushfile.rb')
  self.environment = hash.fetch(:environment, 'development')

  # sidekiq
  self.sidekiq_options = hash.fetch(:sidekiq_options, '')
end

Public Instance Methods

gushfile() click to toggle source
# File lib/gush/configuration.rb, line 27
def gushfile
  @gushfile.realpath
end
gushfile=(path) click to toggle source
# File lib/gush/configuration.rb, line 23
def gushfile=(path)
  @gushfile = Pathname(path)
end
to_hash() click to toggle source
# File lib/gush/configuration.rb, line 31
def to_hash
  {
    concurrency: concurrency,
    namespace:   namespace,
    redis_url:   redis_url,
    redis_prefix:   redis_prefix,
    sidekiq_queue:   sidekiq_queue,
    environment: environment
  }
end
to_json() click to toggle source
# File lib/gush/configuration.rb, line 42
def to_json
  Gush::JSON.encode(to_hash)
end