Class: Hipbot::Reaction
- Inherits:
-
Struct
- Object
- Struct
- Hipbot::Reaction
- Includes:
- Cache
- Defined in:
- lib/hipbot/reaction.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#options ⇒ Object
Returns the value of attribute options.
-
#plugin ⇒ Object
Returns the value of attribute plugin.
Instance Method Summary collapse
- #condition ⇒ Object
- #delete ⇒ Object
- #desc ⇒ Object
- #from_all? ⇒ Boolean
- #from_anywhere? ⇒ Boolean
- #global? ⇒ Boolean
- #in_any_room? ⇒ Boolean
- #match_with(message) ⇒ Object
- #plugin_name ⇒ Object
- #to_anything? ⇒ Boolean
- #to_private_message? ⇒ Boolean
Methods included from Cache
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block
2 3 4 |
# File 'lib/hipbot/reaction.rb', line 2 def block @block end |
#options ⇒ Object
Returns the value of attribute options
2 3 4 |
# File 'lib/hipbot/reaction.rb', line 2 def @options end |
#plugin ⇒ Object
Returns the value of attribute plugin
2 3 4 |
# File 'lib/hipbot/reaction.rb', line 2 def plugin @plugin end |
Instance Method Details
#condition ⇒ Object
17 18 19 |
# File 'lib/hipbot/reaction.rb', line 17 def condition [:if] || Proc.new{ true } end |
#delete ⇒ Object
21 22 23 |
# File 'lib/hipbot/reaction.rb', line 21 def delete plugin.reactions.delete(self) end |
#desc ⇒ Object
25 26 27 |
# File 'lib/hipbot/reaction.rb', line 25 def desc [:desc] end |
#from_all? ⇒ Boolean
29 30 31 |
# File 'lib/hipbot/reaction.rb', line 29 def from_all? [:from].nil? end |
#from_anywhere? ⇒ Boolean
13 14 15 |
# File 'lib/hipbot/reaction.rb', line 13 def from_anywhere? [:room].nil? end |
#global? ⇒ Boolean
33 34 35 |
# File 'lib/hipbot/reaction.rb', line 33 def global? !![:global] end |
#in_any_room? ⇒ Boolean
5 6 7 |
# File 'lib/hipbot/reaction.rb', line 5 def in_any_room? [:room] == true end |
#match_with(message) ⇒ Object
41 42 43 |
# File 'lib/hipbot/reaction.rb', line 41 def match_with Match.new(self, ) end |
#plugin_name ⇒ Object
37 38 39 |
# File 'lib/hipbot/reaction.rb', line 37 def plugin_name plugin.name.demodulize end |
#to_anything? ⇒ Boolean
9 10 11 |
# File 'lib/hipbot/reaction.rb', line 9 def to_anything? regexps.empty? end |
#to_private_message? ⇒ Boolean
45 46 47 |
# File 'lib/hipbot/reaction.rb', line 45 def [:room] == false end |