Class: Butler::Plugin::Trigger
- Inherits:
-
Object
- Object
- Butler::Plugin::Trigger
- Defined in:
- lib/butler/plugin/trigger.rb
Instance Attribute Summary collapse
-
#authorization ⇒ Object
readonly
Returns the value of attribute authorization.
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#plugin ⇒ Object
readonly
Returns the value of attribute plugin.
-
#trigger ⇒ Object
readonly
Returns the value of attribute trigger.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #abort_invocations? ⇒ Boolean
- #call(message) ⇒ Object
- #eql?(other) ⇒ Boolean
-
#initialize(plugin, language, trigger) ⇒ Trigger
constructor
A new instance of Trigger.
- #invoked_by?(message) ⇒ Boolean
- #priority ⇒ Object
Constructor Details
#initialize(plugin, language, trigger) ⇒ Trigger
Returns a new instance of Trigger.
24 25 26 27 28 29 30 31 |
# File 'lib/butler/plugin/trigger.rb', line 24 def initialize(plugin, language, trigger) @plugin = plugin @language = language @trigger = trigger.downcase @authorization = "plugin/#{@plugin.base}".freeze @name = "trigger:#{@language}:#{@trigger}".freeze @hash = @name.hash end |
Instance Attribute Details
#authorization ⇒ Object (readonly)
Returns the value of attribute authorization.
16 17 18 |
# File 'lib/butler/plugin/trigger.rb', line 16 def @authorization end |
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
17 18 19 |
# File 'lib/butler/plugin/trigger.rb', line 17 def hash @hash end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
18 19 20 |
# File 'lib/butler/plugin/trigger.rb', line 18 def language @language end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
19 20 21 |
# File 'lib/butler/plugin/trigger.rb', line 19 def name @name end |
#plugin ⇒ Object (readonly)
Returns the value of attribute plugin.
20 21 22 |
# File 'lib/butler/plugin/trigger.rb', line 20 def plugin @plugin end |
#trigger ⇒ Object (readonly)
Returns the value of attribute trigger.
21 22 23 |
# File 'lib/butler/plugin/trigger.rb', line 21 def trigger @trigger end |
Instance Method Details
#<=>(other) ⇒ Object
45 46 47 |
# File 'lib/butler/plugin/trigger.rb', line 45 def <=>(other) 0 <=> other.priority end |
#abort_invocations? ⇒ Boolean
49 50 51 |
# File 'lib/butler/plugin/trigger.rb', line 49 def abort_invocations? true end |
#call(message) ⇒ Object
37 38 39 |
# File 'lib/butler/plugin/trigger.rb', line 37 def call() @plugin.new().on_trigger end |
#eql?(other) ⇒ Boolean
53 54 55 |
# File 'lib/butler/plugin/trigger.rb', line 53 def eql?(other) other.kind_of?(Trigger) && @name.eql?(other.name) end |
#invoked_by?(message) ⇒ Boolean
33 34 35 |
# File 'lib/butler/plugin/trigger.rb', line 33 def invoked_by?() [] end |
#priority ⇒ Object
41 42 43 |
# File 'lib/butler/plugin/trigger.rb', line 41 def priority 0 end |