@return the XMLDecl
encoding of this document as an Encoding
object. If no XMLDecl
has been set, returns the default encoding.
Inherited from Encoding
Overridden to support optimized en/decoding
Returns the canceled status.
Selects specified components from URI
.
require 'uri' uri = URI.parse('http://myuser:mypass@my.example.com/test.rbx') uri.select(:userinfo, :host, :path) # => ["myuser:mypass", "my.example.com", "/test.rbx"]
Mounts servlet
on dir
passing options
to the servlet at creation time
If a block is provided, returns a new array containing [key, value] pairs for which the block returns true.
Otherwise, same as values_at
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 whether the form contained multipart/form-data
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 an Integer
, a Float
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]
Changes the encoding to encoding
and returns self.
Returns true for a string which is 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
Unicode Normalization—Returns a normalized form of str
, using Unicode normalizations NFC, NFD, NFKC, or NFKD. The normalization form used is determined by form
, which can be 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 other than UTF-8 is implemented by converting to UTF-8, which makes it slower than UTF-8.
"a\u0300".unicode_normalize #=> "\u00E0" "a\u0300".unicode_normalize(:nfc) #=> "\u00E0" "\u00E0".unicode_normalize(:nfd) #=> "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.