Same as XMLRPC::Client#multicall
, but returns two parameters instead of raising an XMLRPC::FaultException
.
Generates a XML-RPC methodResponse document
When is_ret
is false
then the params
array must contain only one element, which is a structure of a fault return-value.
When is_ret
is true
then a normal return-value of all the given params
is created.
Set
value
as the new date/time component.
Raises an ArgumentError
if the given value
isn’t between 1 and 12.
Alias for XMLRPC::DateTime#month=
.
If a block is provided, returns a new array containing [key, value] pairs for which the block returns true.
Otherwise, same as values_at
Returns whether the form contained multipart/form-data
Undo escaping such as that done by CGI::escapeElement()
print CGI::unescapeElement( CGI::escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG") # "<BR><A HREF="url"></A>" print CGI::unescapeElement( CGI::escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"]) # "<BR><A HREF="url"></A>"
Returns a normalized form of str
, using Unicode normalizations NFC, NFD, NFKC, or NFKD. The normalization form used is determined by form
, which is any of the four values :nfc, :nfd, :nfkc, or :nfkd. The default is :nfc.
If the string is not in a Unicode Encoding
, then an Exception
is raised. In this context, ‘Unicode Encoding’ means any of UTF-8, UTF-16BE/LE, and UTF-32BE/LE, as well as GB18030, UCS_2BE, and UCS_4BE. Anything else than UTF-8 is implemented by converting to UTF-8, which makes it slower than UTF-8.
Examples
"a\u0300".unicode_normalize #=> 'à' (same as "\u00E0") "a\u0300".unicode_normalize(:nfc) #=> 'à' (same as "\u00E0") "\u00E0".unicode_normalize(:nfd) #=> 'à' (same as "a\u0300") "\xE0".force_encoding('ISO-8859-1').unicode_normalize(:nfd) #=> Encoding::CompatibilityError raised
Destructive version of String#unicode_normalize
, doing Unicode normalization in place.
Checks whether str
is in Unicode normalization form form
, which is any of the four values :nfc, :nfd, :nfkc, or :nfkd. The default is :nfc.
If the string is not in a Unicode Encoding
, then an Exception
is raised. For details, see String#unicode_normalize
.
Examples
"a\u0300".unicode_normalized? #=> false "a\u0300".unicode_normalized?(:nfd) #=> true "\u00E0".unicode_normalized? #=> true "\u00E0".unicode_normalized?(:nfd) #=> false "\xE0".force_encoding('ISO-8859-1').unicode_normalized? #=> Encoding::CompatibilityError raised
Changes the encoding to encoding
and returns self.
Returns true for a string which encoded correctly.
"\xc2\xa1".force_encoding("UTF-8").valid_encoding? #=> true "\xc2".force_encoding("UTF-8").valid_encoding? #=> false "\x80".force_encoding("UTF-8").valid_encoding? #=> false
Returns whether ASCII-compatible or not.
Encoding::UTF_8.ascii_compatible? #=> true Encoding::UTF_16BE.ascii_compatible? #=> false
Returns the singleton class of obj. This method creates a new singleton class if obj does not have one.
If obj is nil
, true
, or false
, it returns NilClass
, TrueClass
, or FalseClass
, respectively. If obj is a Fixnum
or a Symbol
, it raises a TypeError
.
Object.new.singleton_class #=> #<Class:#<Object:0xb7ce1e24>> String.singleton_class #=> #<Class:String> nil.singleton_class #=> NilClass
Returns the list of protected methods accessible to obj. If the all parameter is set to false
, only those methods in the receiver will be listed.
Returns an array of instance variable names for the receiver. Note that simply defining an accessor does not create the corresponding instance variable.
class Fred attr_accessor :a1 def initialize @iv = 3 end end Fred.new.instance_variables #=> [:@iv]
This method is equivalent to d >> n
This method is equivalent to d << n
Returns the Encoding
object that represents the encoding of the file. If io is in write mode and no encoding is specified, returns nil
.
Returns the Encoding
of the internal string if conversion is specified. Otherwise returns nil
.
If single argument is specified, read string from io is tagged with the encoding specified. If encoding is a colon separated two encoding names “A:B”, the read string is converted from encoding A (external encoding) to encoding B (internal encoding), then tagged with B. If two arguments are specified, those must be encoding objects or encoding names, and the first one is the external encoding, and the second one is the internal encoding. If the external encoding and the internal encoding is specified, optional hash argument specify the conversion option.