Class: Hipbot::Reaction

Inherits:
Struct
  • Object
show all
Includes:
Cache
Defined in:
lib/hipbot/reaction.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Cache

#_cache

Instance Attribute Details

#blockObject

Returns the value of attribute block

Returns:

  • (Object)

    the current value of block



2
3
4
# File 'lib/hipbot/reaction.rb', line 2

def block
  @block
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



2
3
4
# File 'lib/hipbot/reaction.rb', line 2

def options
  @options
end

#pluginObject

Returns the value of attribute plugin

Returns:

  • (Object)

    the current value of plugin



2
3
4
# File 'lib/hipbot/reaction.rb', line 2

def plugin
  @plugin
end

Instance Method Details

#conditionObject



17
18
19
# File 'lib/hipbot/reaction.rb', line 17

def condition
  options[:if] || Proc.new{ true }
end

#deleteObject



21
22
23
# File 'lib/hipbot/reaction.rb', line 21

def delete
  plugin.reactions.delete(self)
end

#descObject



25
26
27
# File 'lib/hipbot/reaction.rb', line 25

def desc
  options[:desc]
end

#from_all?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/hipbot/reaction.rb', line 29

def from_all?
  options[:from].nil?
end

#from_anywhere?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/hipbot/reaction.rb', line 13

def from_anywhere?
  options[:room].nil?
end

#global?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/hipbot/reaction.rb', line 33

def global?
  !!options[:global]
end

#in_any_room?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/hipbot/reaction.rb', line 5

def in_any_room?
  options[:room] == true
end

#match_with(message) ⇒ Object



41
42
43
# File 'lib/hipbot/reaction.rb', line 41

def match_with message
  Match.new(self, message)
end

#plugin_nameObject



37
38
39
# File 'lib/hipbot/reaction.rb', line 37

def plugin_name
  plugin.name.demodulize
end

#to_anything?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/hipbot/reaction.rb', line 9

def to_anything?
  regexps.empty?
end

#to_private_message?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/hipbot/reaction.rb', line 45

def to_private_message?
  options[:room] == false
end