Class: Itamae::Notification
- Inherits:
-
Struct
- Object
- Struct
- Itamae::Notification
- Defined in:
- lib/itamae/notification.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#defined_in_resource ⇒ Object
Returns the value of attribute defined_in_resource.
-
#target_resource_desc ⇒ Object
Returns the value of attribute target_resource_desc.
-
#timing ⇒ Object
Returns the value of attribute timing.
Class Method Summary collapse
Instance Method Summary collapse
- #action_resource ⇒ Object
- #delayed? ⇒ Boolean
- #immediately? ⇒ Boolean
- #resource ⇒ Object
- #run ⇒ Object
- #runner ⇒ Object
- #validate! ⇒ Object
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action
4 5 6 |
# File 'lib/itamae/notification.rb', line 4 def action @action end |
#defined_in_resource ⇒ Object
Returns the value of attribute defined_in_resource
4 5 6 |
# File 'lib/itamae/notification.rb', line 4 def defined_in_resource @defined_in_resource end |
#target_resource_desc ⇒ Object
Returns the value of attribute target_resource_desc
4 5 6 |
# File 'lib/itamae/notification.rb', line 4 def target_resource_desc @target_resource_desc end |
#timing ⇒ Object
Returns the value of attribute timing
4 5 6 |
# File 'lib/itamae/notification.rb', line 4 def timing @timing end |
Class Method Details
.create(*args) ⇒ Object
5 6 7 |
# File 'lib/itamae/notification.rb', line 5 def self.create(*args) self.new(*args).tap(&:validate!) end |
Instance Method Details
#action_resource ⇒ Object
17 18 19 |
# File 'lib/itamae/notification.rb', line 17 def action_resource resource end |
#delayed? ⇒ Boolean
25 26 27 |
# File 'lib/itamae/notification.rb', line 25 def delayed? [:delay, :delayed].include?(timing) end |
#immediately? ⇒ Boolean
29 30 31 |
# File 'lib/itamae/notification.rb', line 29 def immediately? timing == :immediately end |
#resource ⇒ Object
9 10 11 |
# File 'lib/itamae/notification.rb', line 9 def resource runner.children.find_resource_by_description(target_resource_desc) end |
#run ⇒ Object
13 14 15 |
# File 'lib/itamae/notification.rb', line 13 def run action_resource.run(action) end |
#runner ⇒ Object
21 22 23 |
# File 'lib/itamae/notification.rb', line 21 def runner defined_in_resource.recipe.runner end |