Class: Easyhooks::Trigger
Constant Summary
Constants included from Validators
Validators::ALLOWED_METHODS, Validators::ALLOWED_ON_VALUES, Validators::ALLOWED_TYPES
Instance Attribute Summary collapse
-
#actions ⇒ Object
Returns the value of attribute actions.
-
#args ⇒ Object
Returns the value of attribute args.
-
#on ⇒ Object
Returns the value of attribute on.
-
#only ⇒ Object
Returns the value of attribute only.
Attributes inherited from Base
#condition, #hook, #name, #on_fail, #payload, #type
Instance Method Summary collapse
- #add_action(action) ⇒ Object
-
#initialize(name, hook, args = {}) ⇒ Trigger
constructor
A new instance of Trigger.
Constructor Details
#initialize(name, hook, args = {}) ⇒ Trigger
Returns a new instance of Trigger.
10 11 12 13 14 15 16 |
# File 'lib/easyhooks/trigger.rb', line 10 def initialize(name, hook, args = {}) super(name, args[:type], hook, args[:if], args[:payload], args[:on_fail]) @args = args @on = validate_on(args[:on]) @only = validate_only(args[:only]) @actions = [] end |
Instance Attribute Details
#actions ⇒ Object
Returns the value of attribute actions.
8 9 10 |
# File 'lib/easyhooks/trigger.rb', line 8 def actions @actions end |
#args ⇒ Object
Returns the value of attribute args.
8 9 10 |
# File 'lib/easyhooks/trigger.rb', line 8 def args @args end |
#on ⇒ Object
Returns the value of attribute on.
8 9 10 |
# File 'lib/easyhooks/trigger.rb', line 8 def on @on end |
#only ⇒ Object
Returns the value of attribute only.
8 9 10 |
# File 'lib/easyhooks/trigger.rb', line 8 def only @only end |
Instance Method Details
#add_action(action) ⇒ Object
18 19 20 |
# File 'lib/easyhooks/trigger.rb', line 18 def add_action(action) @actions.push(action) end |