Class: CampfireBot::Event::Interval
Instance Attribute Summary
Attributes inherited from EventHandler
#kind, #matcher, #method, #plugin
Instance Method Summary
collapse
handles
Constructor Details
#initialize(*args) ⇒ Interval
73
74
75
76
|
# File 'lib/event.rb', line 73
def initialize(*args)
@last_run = ::Time.now
super(*args)
end
|
Instance Method Details
#match? ⇒ Boolean
78
79
80
|
# File 'lib/event.rb', line 78
def match?
@last_run < ::Time.now - @matcher
end
|
#run(msg, force = false) ⇒ Object
82
83
84
85
86
87
88
89
|
# File 'lib/event.rb', line 82
def run(msg, force = false)
if match?
@last_run = ::Time.now
Plugin.registered_plugins[@plugin].send(@method, msg)
else
false
end
end
|