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
2 3 4 |
# File 'lib/itamae/notification.rb', line 2 def action @action end |
#defined_in_resource ⇒ Object
Returns the value of attribute defined_in_resource
2 3 4 |
# File 'lib/itamae/notification.rb', line 2 def defined_in_resource @defined_in_resource end |
#target_resource_desc ⇒ Object
Returns the value of attribute target_resource_desc
2 3 4 |
# File 'lib/itamae/notification.rb', line 2 def target_resource_desc @target_resource_desc end |
#timing ⇒ Object
Returns the value of attribute timing
2 3 4 |
# File 'lib/itamae/notification.rb', line 2 def timing @timing end |
Class Method Details
.create(*args) ⇒ Object
3 4 5 |
# File 'lib/itamae/notification.rb', line 3 def self.create(*args) self.new(*args).tap(&:validate!) end |
Instance Method Details
#action_resource ⇒ Object
15 16 17 |
# File 'lib/itamae/notification.rb', line 15 def action_resource resource end |
#delayed? ⇒ Boolean
23 24 25 |
# File 'lib/itamae/notification.rb', line 23 def delayed? [:delay, :delayed].include?(timing) end |
#immediately? ⇒ Boolean
27 28 29 |
# File 'lib/itamae/notification.rb', line 27 def immediately? timing == :immediately end |
#resource ⇒ Object
7 8 9 |
# File 'lib/itamae/notification.rb', line 7 def resource runner.children.find_resource_by_description(target_resource_desc) end |
#run ⇒ Object
11 12 13 |
# File 'lib/itamae/notification.rb', line 11 def run action_resource.run(action) end |
#runner ⇒ Object
19 20 21 |
# File 'lib/itamae/notification.rb', line 19 def runner defined_in_resource.recipe.runner end |