Class: Itamae::Definition
- Inherits:
-
Resource::Base
- Object
- Resource::Base
- Itamae::Definition
- Defined in:
- lib/itamae/definition.rb
Defined Under Namespace
Classes: Context
Instance Attribute Summary
Attributes inherited from Resource::Base
#attributes, #current_attributes, #notifications, #recipe, #resource_name, #subscriptions, #updated
Class Method Summary collapse
- .create_class(name, params, &block) ⇒ Object
- .definition_block ⇒ Object
- .definition_block=(block) ⇒ Object
Instance Method Summary collapse
- #action_run(options) ⇒ Object
-
#initialize(*args) ⇒ Definition
constructor
A new instance of Definition.
Methods inherited from Resource::Base
#action_nothing, define_attribute, inherited, #resource_type, #run
Constructor Details
#initialize(*args) ⇒ Definition
Returns a new instance of Definition.
26 27 28 29 30 |
# File 'lib/itamae/definition.rb', line 26 def initialize(*args) super construct_resources end |
Class Method Details
.create_class(name, params, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/itamae/definition.rb', line 6 def create_class(name, params, &block) Class.new(self).tap do |klass| klass.definition_block = block klass.define_attribute :action, default: :run params.each_pair do |key, value| klass.define_attribute key.to_sym, type: Object, default: value end end end |
.definition_block ⇒ Object
21 22 23 |
# File 'lib/itamae/definition.rb', line 21 def definition_block @definition_block end |
.definition_block=(block) ⇒ Object
17 18 19 |
# File 'lib/itamae/definition.rb', line 17 def definition_block=(block) @definition_block = block end |
Instance Method Details
#action_run(options) ⇒ Object
32 33 34 |
# File 'lib/itamae/definition.rb', line 32 def action_run() @children.run() end |