Class: CookbookOmnifetch::Integration
- Inherits:
-
Object
- Object
- CookbookOmnifetch::Integration
- Defined in:
- lib/cookbook-omnifetch/integration.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Integration
constructor
A new instance of Integration.
Constructor Details
#initialize ⇒ Integration
Returns a new instance of Integration.
47 48 49 50 51 52 |
# File 'lib/cookbook-omnifetch/integration.rb', line 47 def initialize self.class.configurables.each do |configurable| instance_variable_set("@#{configurable}".to_sym, NullValue.new) end @chef_server_download_concurrency = 1 end |
Class Method Details
.configurable(name) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cookbook-omnifetch/integration.rb', line 15 def self.configurable(name) configurables << name attr_writer name define_method(name) do value = instance_variable_get("@#{name}".to_sym) case value when NullValue raise MissingConfiguration, "`#{name}` is not configured" when Proc value.call else value end end end |
.configurables ⇒ Object
11 12 13 |
# File 'lib/cookbook-omnifetch/integration.rb', line 11 def self.configurables @configurables ||= [] end |