Class: Butler::Plugin::Trigger
- Inherits:
-
Object
- Object
- Butler::Plugin::Trigger
- Defined in:
- lib/butler/plugin/trigger.rb
Constant Summary collapse
- Priority =
0
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.
26 27 28 29 30 31 32 33 |
# File 'lib/butler/plugin/trigger.rb', line 26 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.
18 19 20 |
# File 'lib/butler/plugin/trigger.rb', line 18 def @authorization end |
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
19 20 21 |
# File 'lib/butler/plugin/trigger.rb', line 19 def hash @hash end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
20 21 22 |
# File 'lib/butler/plugin/trigger.rb', line 20 def language @language end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
21 22 23 |
# File 'lib/butler/plugin/trigger.rb', line 21 def name @name end |
#plugin ⇒ Object (readonly)
Returns the value of attribute plugin.
22 23 24 |
# File 'lib/butler/plugin/trigger.rb', line 22 def plugin @plugin end |
#trigger ⇒ Object (readonly)
Returns the value of attribute trigger.
23 24 25 |
# File 'lib/butler/plugin/trigger.rb', line 23 def trigger @trigger end |
Instance Method Details
#<=>(other) ⇒ Object
47 48 49 |
# File 'lib/butler/plugin/trigger.rb', line 47 def <=>(other) other.priority <=> Priority end |
#abort_invocations? ⇒ Boolean
51 52 53 |
# File 'lib/butler/plugin/trigger.rb', line 51 def abort_invocations? true end |
#call(message) ⇒ Object
39 40 41 |
# File 'lib/butler/plugin/trigger.rb', line 39 def call() @plugin.new().on_trigger end |
#eql?(other) ⇒ Boolean
55 56 57 |
# File 'lib/butler/plugin/trigger.rb', line 55 def eql?(other) other.kind_of?(Trigger) && @name.eql?(other.name) end |
#invoked_by?(message) ⇒ Boolean
35 36 37 |
# File 'lib/butler/plugin/trigger.rb', line 35 def invoked_by?() [] end |
#priority ⇒ Object
43 44 45 |
# File 'lib/butler/plugin/trigger.rb', line 43 def priority Priority end |