Class: Clockker::Config
- Inherits:
-
Object
- Object
- Clockker::Config
- Defined in:
- lib/clockker/config.rb
Instance Attribute Summary collapse
-
#blacklist ⇒ Object
Returns the value of attribute blacklist.
-
#config_version ⇒ Object
Returns the value of attribute config_version.
-
#development ⇒ Object
Returns the value of attribute development.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
-
#region ⇒ Object
Returns the value of attribute region.
-
#submit_frequency ⇒ Object
Returns the value of attribute submit_frequency.
-
#token ⇒ Object
Returns the value of attribute token.
-
#url_whitelist ⇒ Object
Returns the value of attribute url_whitelist.
-
#whitelist ⇒ Object
Returns the value of attribute whitelist.
Instance Method Summary collapse
-
#initialize(overrides = {}) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(overrides = {}) ⇒ Config
Returns a new instance of Config.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/clockker/config.rb', line 6 def initialize(overrides = {}) if File.exists?(File.join(Dir.home, '.clockker')) clockker_config = JSON.parse(File.read(File.join(Dir.home, '.clockker'))) else clockker_config = '{}' end # Set values from clockker_config @whitelist = clockker_config["whitelist"] @blacklist = clockker_config["blacklist"] @url_whitelist = clockker_config["url_whitelist"] @config_version = clockker_config["version"] @token = clockker_config["token"] @region = clockker_config["region"] @submit_frequency = clockker_config["submit_frequency"] @log_level = clockker_config["log_level"] @development = clockker_config["development"] # override values specified at the command line overrides.each do |key, value| instance_variable_set "@#{key}".to_sym, value end end |
Instance Attribute Details
#blacklist ⇒ Object
Returns the value of attribute blacklist.
5 6 7 |
# File 'lib/clockker/config.rb', line 5 def blacklist @blacklist end |
#config_version ⇒ Object
Returns the value of attribute config_version.
5 6 7 |
# File 'lib/clockker/config.rb', line 5 def config_version @config_version end |
#development ⇒ Object
Returns the value of attribute development.
5 6 7 |
# File 'lib/clockker/config.rb', line 5 def development @development end |
#identifier ⇒ Object
Returns the value of attribute identifier.
5 6 7 |
# File 'lib/clockker/config.rb', line 5 def identifier @identifier end |
#log_level ⇒ Object
Returns the value of attribute log_level.
5 6 7 |
# File 'lib/clockker/config.rb', line 5 def log_level @log_level end |
#region ⇒ Object
Returns the value of attribute region.
5 6 7 |
# File 'lib/clockker/config.rb', line 5 def region @region end |
#submit_frequency ⇒ Object
Returns the value of attribute submit_frequency.
5 6 7 |
# File 'lib/clockker/config.rb', line 5 def submit_frequency @submit_frequency end |
#token ⇒ Object
Returns the value of attribute token.
5 6 7 |
# File 'lib/clockker/config.rb', line 5 def token @token end |
#url_whitelist ⇒ Object
Returns the value of attribute url_whitelist.
5 6 7 |
# File 'lib/clockker/config.rb', line 5 def url_whitelist @url_whitelist end |
#whitelist ⇒ Object
Returns the value of attribute whitelist.
5 6 7 |
# File 'lib/clockker/config.rb', line 5 def whitelist @whitelist end |