module CultomePlayer::Plugins

Public Instance Methods

clean_plugins() click to toggle source
# File lib/cultome_player/plugins.rb, line 45
def clean_plugins
  methods.grep(/^clean_plugin_/).each{|method_name| send(method_name) }
end
init_plugins() click to toggle source

Call init_plugin_<action> to initialize all the plugins that require it.

# File lib/cultome_player/plugins.rb, line 41
def init_plugins
  methods.grep(/^init_plugin_/).each{|method_name| send(method_name) }
end
plugin_command_sintax(cmd_name) click to toggle source

Get a command format for a command implemented by a plugin

@param cmd_name [String] The command name. @return [Regex] The regex to validate a command format that is implemented by a plugin.

# File lib/cultome_player/plugins.rb, line 27
def plugin_command_sintax(cmd_name)
  return send("sintax_#{cmd_name}".to_sym)
end
plugin_config(plugin_name) click to toggle source

Lazy getter for plugins configurator. Its a persistent store where plugin can put their configurations.

@param plugin_name [#to_s] The name of the plugin. @return [Hash] Where plugins can stores their information.

# File lib/cultome_player/plugins.rb, line 35
def plugin_config(plugin_name)
  plugin_ns = player_config['plugins'] ||= {}
  return plugin_ns[plugin_name.to_s] ||= {}
end
plugins_respond_to?(cmd_name) click to toggle source

Check if a plugin implements the given command.

@param cmd_name [String] The command name. @return [Boolean] True is the given command is implemented by a plugin.

# File lib/cultome_player/plugins.rb, line 19
def plugins_respond_to?(cmd_name)
  return respond_to?("command_#{cmd_name}".to_sym)
end