module Irc::Bot::Plugins::WebBotModule

Mixin for plugins that want to provide a web interface of some sort.

Plugins include the module and can then use web_map to register a url to handle.

Public Instance Methods

cleanup() click to toggle source

Redefine the default cleanup method.

Calls superclass method
# File lib/rbot/core/webservice.rb, line 341
def cleanup
  super
  web_cleanup
end
web_cleanup() click to toggle source

Unregister the remote maps.

# File lib/rbot/core/webservice.rb, line 331
def web_cleanup
  return unless defined? @web_maps
  @web_maps.each { |h|
    @bot.web_dispatcher.unmap(self, h)
  }
  @web_maps.clear
end
web_map(*args) click to toggle source

The remote_map acts just like the BotModule#map method, except that the map is registered to the @bot’s remote_dispatcher. Also, the remote map handle is handled for the cleanup management

# File lib/rbot/core/webservice.rb, line 323
def web_map(*args)
  # stores the handles/indexes for cleanup:
  @web_maps = Array.new unless defined? @web_maps
  @web_maps << @bot.web_dispatcher.map(self, *args)
end