Module: CronKubernetes::Configurable
- Included in:
- CronKubernetes
- Defined in:
- lib/cron_kubernetes/configurable.rb
Overview
Provides configuration settings, with default values, for the gem.
Instance Method Summary collapse
- #configuration {|_self| ... } ⇒ Object
-
#define_setting(name, default = nil) ⇒ Object
Define a configuration setting and its default value.
Instance Method Details
#configuration {|_self| ... } ⇒ Object
6 7 8 |
# File 'lib/cron_kubernetes/configurable.rb', line 6 def configuration yield self end |
#define_setting(name, default = nil) ⇒ Object
Define a configuration setting and its default value.
name: The name of the setting. default: A default value for the setting. (Optional) rubocop: disable Style/ClassVars
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cron_kubernetes/configurable.rb', line 15 def define_setting(name, default = nil) class_variable_set("@@#{name}", default) define_class_method "#{name}=" do |value| class_variable_set("@@#{name}", value) end define_class_method name do class_variable_get("@@#{name}") end end |