Module: Lakitu::Options
- Defined in:
- lib/lakitu/options.rb
Constant Summary collapse
- DEFAULTS =
{ refresh_interval_minutes: 10 }
- PROFILE_DEFAULTS =
{ ignore: false, format: "%{profile}-%{name}-%{id}" }
- @@options =
nil
Class Method Summary collapse
- .config_options ⇒ Object
- .default_config ⇒ Object
- .merge(arg) ⇒ Object
- .options ⇒ Object
- .options=(arg) ⇒ Object
Class Method Details
.config_options ⇒ Object
29 30 31 32 |
# File 'lib/lakitu/options.rb', line 29 def self. return { } unless File.exist?(Lakitu::OPTIONS_FILE_PATH) deep_symbolize_keys(::YAML::load(File.read(Lakitu::OPTIONS_FILE_PATH)) || {}) end |
.default_config ⇒ Object
34 35 36 37 |
# File 'lib/lakitu/options.rb', line 34 def self.default_config create_provider_defaults YAML.dump(deep_stringify_keys(.to_h)) end |
.merge(arg) ⇒ Object
25 26 27 |
# File 'lib/lakitu/options.rb', line 25 def self.merge arg @@options = OpenStruct.new(.to_h.merge arg) end |
.options ⇒ Object
14 15 16 17 18 19 |
# File 'lib/lakitu/options.rb', line 14 def self. unless @@options @@options = OpenStruct.new(DEFAULTS.merge ) end @@options end |
.options=(arg) ⇒ Object
21 22 23 |
# File 'lib/lakitu/options.rb', line 21 def self. arg @@options = arg ? OpenStruct.new(arg) : arg end |