module Twke::Routes
Attributes
conn[RW]
Public Class Methods
add(trigger, *opts) { |self| ... }
click to toggle source
# File lib/twke/routes.rb, line 80 def add(trigger, *opts, &blk) cmd do match(trigger, *opts) do # This yields the action (ie, room) context to the # callback. All actions that could be done in the Scamp # 'match' context can be performed on the yielded # object. This lets you pass the context to an EM context # later. # yield(self) end end end
cmd(&blk)
click to toggle source
Run a raw command
# File lib/twke/routes.rb, line 96 def cmd(&blk) @@conn.behaviour(&blk) end
load(scamp)
click to toggle source
# File lib/twke/routes.rb, line 58 def load(scamp) @@conn = scamp # TODO: Only load the configured plugins. # XXX: doesn't feel right to do this in routes... Plugin.plugins.each do |plgin| plgin.load_plugin end # Now ask all loaded plugins to add routes Plugin.loaded_plugins.each do |plgin| plgin.event(:add_routes, RoutePrefix.new($options[:name]), $options) end end
on_connect()
click to toggle source
Invoked (in theory) after we're connected to campfire
# File lib/twke/routes.rb, line 74 def on_connect Plugin.loaded_plugins.each do |plgin| plgin.event(:on_connect, RoutePrefix.new($options[:name]), $options) end end