Class String
In: lib/rbot/botuser.rb
lib/rbot/core/utils/extends.rb
lib/rbot/irc.rb
lib/rbot/ircsocket.rb
lib/rbot/load-gettext.rb
Parent: Object

Extension for String class.

String#% method which accept "named argument". The translator can know the meaning of the msgids using "named argument" instead of %s/%d style.

Methods

External Aliases

% -> _old_format_m

Public Instance methods

Format - Uses str as a format specification, and returns the result of applying it to arg. If the format specification contains more than one substitution, then arg must be an Array containing the values to be substituted. See Kernel::sprintf for details of the format string. This is the default behavior of the String class.

  • arg: an Array or other class except Hash.
  • Returns: formatted String
 (e.g.) "%s, %s" % ["Masao", "Mutoh"]

Also you can use a Hash as the "named argument". This is recommanded way for Ruby-GetText because the translators can understand the meanings of the msgids easily.

  • hash: {:key1 => value1, :key2 => value2, … }
  • Returns: formatted String
 (e.g.) "%{firstname}, %{familyname}" % {:firstname => "Masao", :familyname => "Mutoh"}

This method tries to find an HTML title in the string, and returns it if found

This method checks if the receiver contains IRC glob characters

IRC has a very primitive concept of globs: a * stands for "any number of arbitrary characters", a ? stands for "one and exactly one arbitrary character". These characters can be escaped by prefixing them with a slash (\).

A known limitation of this glob syntax is that there is no way to escape the escape character itself, so it‘s not possible to build a glob pattern where the escape character precedes a glob.

This method returns a string which is the downcased version of the receiver, according to the given casemap

This is the same as the above, except that the string is altered in place

See also the discussion about irc_downcase

Calculate the penalty which will be assigned to this message by the IRCd

Upcasing functions are provided too

See also the discussion about irc_downcase

In-place upcasing

See also the discussion about irc_downcase

This method will return a purified version of the receiver, with all HTML stripped off and some of it converted to IRC formatting

As above, but modify the receiver

This method returns the IRC-formatted version of an HTML title found in the string

This method will strip all HTML crud from the receiver

Returns an Irc::Bot::Auth::Comand from the receiver

This method returns the Irc::Casemap whose name is the receiver

We keep extending String, this time adding a method that converts a String into an Irc::Channel object

Returns an Irc::Channel::Topic with self as text

We keep extending String, this time adding a method that converts a String into an Irc::Netmask object

This method is used to convert the receiver into a Regular Expression that matches according to the IRC glob syntax

We keep extending String, this time adding a method that converts a String into an Irc::User object

[Validate]