Class: CampfireBot::Event::Time

Inherits:
EventHandler show all
Defined in:
lib/event.rb

Instance Attribute Summary

Attributes inherited from EventHandler

#kind, #matcher, #method, #plugin

Instance Method Summary collapse

Methods inherited from EventHandler

handles

Constructor Details

#initialize(*args) ⇒ Time

Returns a new instance of Time.



95
96
97
98
# File 'lib/event.rb', line 95

def initialize(*args)
  @run = false
  super(*args)
end

Instance Method Details

#match?Boolean

Returns:

  • (Boolean)


100
101
102
# File 'lib/event.rb', line 100

def match?
  @matcher <= ::Time.now && !@run
end

#run(force = false) ⇒ Object



104
105
106
107
108
109
110
111
# File 'lib/event.rb', line 104

def run(force = false)
  if match?
    @run = true
    Plugin.registered_plugins[@plugin].send(@method)
  else
    false
  end
end