Module: Irc::Bot::Plugins::WebBotModule

Included in:
WebCoreBotModule, WebPlugin
Defined in:
/home/apoc/projects/ruby/rbot/lib/rbot/core/webservice.rb

Overview

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.

Instance Method Summary (collapse)

Instance Method Details

- (Object) cleanup

Redefine the default cleanup method.



315
316
317
318
# File '/home/apoc/projects/ruby/rbot/lib/rbot/core/webservice.rb', line 315

def cleanup
  super
  web_cleanup
end

- (Object) web_cleanup

Unregister the remote maps.



305
306
307
308
309
310
311
# File '/home/apoc/projects/ruby/rbot/lib/rbot/core/webservice.rb', line 305

def web_cleanup
  return unless defined? @web_maps
  @web_maps.each { |h|
    @bot.web_dispatcher.unmap(self, h)
  }
  @web_maps.clear
end

- (Object) web_map(*args)

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



297
298
299
300
301
# File '/home/apoc/projects/ruby/rbot/lib/rbot/core/webservice.rb', line 297

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