Class: RSpectacles::Config
- Inherits:
-
Object
- Object
- RSpectacles::Config
show all
- Defined in:
- lib/rspectacles/config.rb
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
8
9
10
|
# File 'lib/rspectacles/config.rb', line 8
def initialize
@opts = OpenStruct.new defaults.merge(yml)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
25
26
27
|
# File 'lib/rspectacles/config.rb', line 25
def method_missing(method, *args)
@opts.public_send method, *args
end
|
Instance Method Details
#defaults ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/rspectacles/config.rb', line 12
def defaults
{
batch_size: (ENV['RSPECTACLES_BATCH_SIZE'] || 1000).to_i,
last_run_primary_key: ENV['RSPECTACLES_RUN_KEY'] || ENV['CIRCLE_BUILD_NUM'] || SecureRandom.hex,
timeout: (ENV['RSPECTACLES_TIMEOUT'] || 15).to_i,
rspectacles_url: ENV['RSPECTACLES_URL']
}
end
|
#timeout ⇒ Object
21
22
23
|
# File 'lib/rspectacles/config.rb', line 21
def timeout
@opts[:timeout]
end
|