Class: Burst::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/burst/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ Configuration

Returns a new instance of Configuration.



11
12
13
# File 'lib/burst/configuration.rb', line 11

def initialize(hash = {})
  self.concurrency = hash.fetch(:concurrency, 5)
end

Instance Attribute Details

#concurrencyObject

Returns the value of attribute concurrency.



5
6
7
# File 'lib/burst/configuration.rb', line 5

def concurrency
  @concurrency
end

Class Method Details

.from_json(json) ⇒ Object



7
8
9
# File 'lib/burst/configuration.rb', line 7

def self.from_json(json)
  new(Burst::JSON.decode(json, symbolize_keys: true))
end

Instance Method Details

#to_hashObject



15
16
17
18
19
# File 'lib/burst/configuration.rb', line 15

def to_hash
  {
    concurrency: concurrency
  }
end

#to_jsonObject



21
22
23
# File 'lib/burst/configuration.rb', line 21

def to_json
  Burst::JSON.encode(to_hash)
end