Method: Irc::Bot::Auth::Command#sanitize_command_path
- Defined in:
- lib/rbot/botuser.rb
#sanitize_command_path(cmd) ⇒ Object
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
76 77 78 79 80 81 |
# File 'lib/rbot/botuser.rb', line 76 def sanitize_command_path(cmd) pre = cmd.to_s.downcase.gsub(/^\*?(?:::)?/,"").gsub(/::$/,"") return pre if pre.empty? return pre if pre =~ /^\S+(::\S+)*$/ raise TypeError, "#{cmd.inspect} is not a valid command" end |