Revision 476368e8
Added by Marc Dequènes over 13 years ago
- ID 476368e89610c1079a6a5c869254f3958533484d
lib/cyborghood/cyborg/interface.rb | ||
---|---|---|
module CyborgServerInterfaceBase
|
||
NODE_PATTERN = "((?:\/|(?:\/[a-zA-Z0-9._]+)+[?=]?))"
|
||
|
||
attr_accessor :bot
|
||
|
||
def self.included(base)
|
||
base.extend(ClassMethods)
|
||
end
|
||
... | ... | |
end
|
||
|
||
def api_methods
|
||
methods = self.class.exported_methods
|
||
methods = []
|
||
methods += self.class.public_instance_methods(false) if self.class.auto_export_public_instance_methods
|
||
methods -= ["initialize", "__destroy", "method_missing"]
|
||
methods & self.methods
|
||
methods &= self.methods
|
||
methods += self.class.exported_methods
|
||
end
|
||
|
||
def api_container_methods
|
||
... | ... | |
# additional mixin
|
||
|
||
module CyborgServerRootInterfaceAddon
|
||
PROTOCOL_VERSION = "0.1~"
|
||
API_VERSION = "0.1~"
|
||
|
||
def self.included(base)
|
||
list = self.public_instance_methods(false)
|
||
base.class_eval do
|
||
export_method list
|
||
export_method *list
|
||
end
|
||
end
|
||
|
||
... | ... | |
VERSION
|
||
end
|
||
|
||
def protocol_version
|
||
PROTOCOL_VERSION
|
||
def api_version
|
||
API_VERSION
|
||
end
|
||
|
||
def bot_name
|
||
@config.bot_name
|
||
@bot.name
|
||
end
|
||
end
|
||
end
|
Also available in: Unified diff
[fix] adapted Interface to recent changes, pass bot object, and correct api_methods() calculation