Class Irc::Bot::Auth::Command
In: lib/rbot/botuser.rb
Parent: Object
BasicUserMessage JoinMessage NamesMessage WhoisMessage ModeChangeMessage KickMessage MotdMessage QuitMessage BanlistMessage UserMessage NoSuchTargetMessage TopicMessage NickMessage WelcomeMessage UnknownMessage InviteMessage PartMessage NetmaskList UserList ArrayOf ChannelList Netmask User\n[lib/rbot/botuser.rb\nlib/rbot/irc.rb] Channel Singleton RfcCasemap StrictRfcCasemap AsciiCasemap Casemap PrivMessage NoticeMessage TokyoCabinet::BDB CIBDB Btree CIBtree Socket MessageQueue QueueRing Client DBHash\n[lib/rbot/registry/bdb.rb\nlib/rbot/registry/tc.rb] DBTree\n[lib/rbot/registry/bdb.rb\nlib/rbot/registry/tc.rb] Server NetmaskDb Bot\n[lib/rbot/botuser.rb\nlib/rbot/config.rb\nlib/rbot/ircbot.rb\nlib/rbot/language.rb\nlib/rbot/message.rb\nlib/rbot/messagemapper.rb\nlib/rbot/plugins.rb\nlib/rbot/rbotconfig.rb\nlib/rbot/registry/bdb.rb\nlib/rbot/registry/tc.rb] lib/rbot/ircsocket.rb lib/rbot/rfc2812.rb lib/rbot/registry/tc.rb lib/rbot/irc.rb lib/rbot/maskdb.rb lib/rbot/message.rb lib/rbot/messagemapper.rb lib/rbot/botuser.rb lib/rbot/registry/tc.rb (null) BotConfig PKGConfig ServerOrCasemap Irc dot/m_35_0.png

An Irc::Bot::Auth::Command defines a command by its "path":

  base::command::subcommand::subsubcommand::subsubsubcommand

Methods

Attributes

command  [R] 
path  [R] 

Public Class methods

Creates a new Command from a given string; you can then access the command as a symbol with the :command method and the whole path as :path

  Command.new("core::auth::save").path => [:"*", :"core", :"core::auth", :"core::auth::save"]

  Command.new("core::auth::save").command => :"core::auth::save"

[Source]

     # File lib/rbot/botuser.rb, line 91
 91:       def initialize(cmd)
 92:         cmdpath = sanitize_command_path(cmd).split('::')
 93:         seq = cmdpath.inject(["*"]) { |list, cmd|
 94:           list << (list.length > 1 ? list.last + "::" : "") + cmd
 95:         }
 96:         @path = seq.map { |k|
 97:           k.to_sym
 98:         }
 99:         @command = path.last
100:         debug "Created command #{@command.inspect} with path #{@path.pretty_inspect}"
101:       end

Public Instance methods

A method that checks if a given cmd is in a form that can be reduced into a canonical command path, and if so, returns it

[Source]

    # File lib/rbot/botuser.rb, line 76
76:       def sanitize_command_path(cmd)
77:         pre = cmd.to_s.downcase.gsub(/^\*?(?:::)?/,"").gsub(/::$/,"")
78:         return pre if pre.empty?
79:         return pre if pre =~ /^\S+(::\S+)*$/
80:         raise TypeError, "#{cmd.inspect} is not a valid command"
81:       end

Returs self

[Source]

     # File lib/rbot/botuser.rb, line 104
104:       def to_irc_auth_command
105:         self
106:       end

[Validate]