Class: Gush::Configuration
- Inherits:
-
Object
- Object
- Gush::Configuration
- Defined in:
- lib/gush/configuration.rb
Instance Attribute Summary collapse
-
#concurrency ⇒ Object
Returns the value of attribute concurrency.
-
#locking_duration ⇒ Object
Returns the value of attribute locking_duration.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#polling_interval ⇒ Object
Returns the value of attribute polling_interval.
-
#redis_url ⇒ Object
Returns the value of attribute redis_url.
-
#ttl ⇒ Object
Returns the value of attribute ttl.
Class Method Summary collapse
Instance Method Summary collapse
- #gushfile ⇒ Object
- #gushfile=(path) ⇒ Object
-
#initialize(hash = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(hash = {}) ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 14 15 16 17 |
# 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) self.locking_duration = hash.fetch(:locking_duration, 2) # how long you want to wait for the lock to be released, in seconds self.polling_interval = hash.fetch(:polling_internal, 0.3) # how long the polling interval should be, in seconds end |
Instance Attribute Details
#concurrency ⇒ Object
Returns the value of attribute concurrency.
3 4 5 |
# File 'lib/gush/configuration.rb', line 3 def concurrency @concurrency end |
#locking_duration ⇒ Object
Returns the value of attribute locking_duration.
3 4 5 |
# File 'lib/gush/configuration.rb', line 3 def locking_duration @locking_duration end |
#namespace ⇒ Object
Returns the value of attribute namespace.
3 4 5 |
# File 'lib/gush/configuration.rb', line 3 def namespace @namespace end |
#polling_interval ⇒ Object
Returns the value of attribute polling_interval.
3 4 5 |
# File 'lib/gush/configuration.rb', line 3 def polling_interval @polling_interval end |
#redis_url ⇒ Object
Returns the value of attribute redis_url.
3 4 5 |
# File 'lib/gush/configuration.rb', line 3 def redis_url @redis_url end |
#ttl ⇒ Object
Returns the value of attribute ttl.
3 4 5 |
# File 'lib/gush/configuration.rb', line 3 def ttl @ttl end |
Class Method Details
Instance Method Details
#gushfile ⇒ Object
23 24 25 |
# File 'lib/gush/configuration.rb', line 23 def gushfile @gushfile.realpath if @gushfile.exist? end |
#gushfile=(path) ⇒ Object
19 20 21 |
# File 'lib/gush/configuration.rb', line 19 def gushfile=(path) @gushfile = Pathname(path) end |
#to_hash ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/gush/configuration.rb', line 27 def to_hash { concurrency: concurrency, namespace: namespace, redis_url: redis_url, ttl: ttl, locking_duration: locking_duration, polling_interval: polling_interval } end |