class AppleBot::Command
Public Class Methods
load_all!()
click to toggle source
# File lib/applebot/commands.rb, line 11 def self.load_all! commands_file_path = File.join(AppleBot.phantom_scripts_path, '_commands.json') commands = JSON.parse(IO.read(commands_file_path)) AppleBot.commands = commands.keys.map {|file| command_config = commands[file] args = [file] + [ command_config['namespace'], command_config['action'], command_config['description'], command_config['options'] ] Command.new(*args) } end
new(*properties)
click to toggle source
Calls superclass method
# File lib/applebot/commands.rb, line 5 def initialize(*properties) options = properties.delete_at -1 super(*properties) self.options = CommandOptionSet.new(options['required'], options['optional']) end
Public Instance Methods
cli_command()
click to toggle source
# File lib/applebot/commands.rb, line 24 def cli_command "#{namespace}:#{action}" end
ruby_method()
click to toggle source
# File lib/applebot/commands.rb, line 28 def ruby_method "#{action}_#{namespace}" end