Handles a doctype declaration. Any attributes of the doctype which are not supplied will be nil. # EG, <!DOCTYPE me PUBLIC “foo” “bar”> @p name the name of the doctype; EG, “me” @p pub_sys “PUBLIC”, “SYSTEM”, or nil. EG, “PUBLIC” @p long_name the supplied long name, or nil. EG, “foo” @p uri the uri of the doctype, or nil. EG, “bar”
<!ENTITY …> The argument passed to this method is an array of the entity declaration. It can be in a number of formats, but in general it returns (example, result):
<!ENTITY % YN '"Yes"'> ["%", "YN", "\"Yes\""] <!ENTITY % YN 'Yes'> ["%", "YN", "Yes"] <!ENTITY WhatHeSaid "He said %YN;"> ["WhatHeSaid", "He said %YN;"] <!ENTITY open-hatch SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml"> ["open-hatch", "SYSTEM", "http://www.textuality.com/boilerplate/OpenHatch.xml"] <!ENTITY open-hatch PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN" "http://www.textuality.com/boilerplate/OpenHatch.xml">
<!ENTITY hatch-pic SYSTEM “../grafix/OpenHatch.gif” NDATA gif>
Handles a doctype declaration. Any attributes of the doctype which are not supplied will be nil. # EG, <!DOCTYPE me PUBLIC “foo” “bar”> @p name the name of the doctype; EG, “me” @p pub_sys “PUBLIC”, “SYSTEM”, or nil. EG, “PUBLIC” @p long_name the supplied long name, or nil. EG, “foo” @p uri the uri of the doctype, or nil. EG, “bar”
<!ENTITY …> The argument passed to this method is an array of the entity declaration. It can be in a number of formats, but in general it returns (example, result):
<!ENTITY % YN '"Yes"'> ["YN", "\"Yes\"", "%"] <!ENTITY % YN 'Yes'> ["YN", "Yes", "%"] <!ENTITY WhatHeSaid "He said %YN;"> ["WhatHeSaid", "He said %YN;"] <!ENTITY open-hatch SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml"> ["open-hatch", "SYSTEM", "http://www.textuality.com/boilerplate/OpenHatch.xml"] <!ENTITY open-hatch PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN" "http://www.textuality.com/boilerplate/OpenHatch.xml"> ["open-hatch", "PUBLIC", "-//Textuality//TEXT Standard open-hatch boilerplate//EN", "http://www.textuality.com/boilerplate/OpenHatch.xml"] <!ENTITY hatch-pic SYSTEM "../grafix/OpenHatch.gif" NDATA gif> ["hatch-pic", "SYSTEM", "../grafix/OpenHatch.gif", "gif"]
Called when %foo; is encountered in a doctype declaration. @p content “foo”
Zlib::GzipReader
wrapper that unzips data
.
URI.unescape(str)
str
Unescapes the string.
require 'uri' enc_uri = URI.escape("http://example.com/?a=\11\15") p enc_uri # => "http://example.com/?a=%09%0D" p URI.unescape(enc_uri) # => "http://example.com/?a=\t\r"
Is code
a redirection status?
Is code
a redirection status?
Unescapes HTTP reserved and unwise characters in str
Executes the passed block and raises exception
if execution takes more than seconds
.
If seconds
is zero or nil, simply executes the block
Executes the passed block and raises exception
if execution takes more than seconds
.
If seconds
is zero or nil, simply executes the block
(see Gem::Resolver::Molinillo::ResolutionState#activated)
(see Gem::Resolver::Molinillo::ResolutionState#conflicts)
Deletes the element at the specified index
, returning that element, or nil
if the index
is out of range.
See also Array#slice!
a = ["ant", "bat", "cat", "dog"] a.delete_at(2) #=> "cat" a #=> ["ant", "bat", "dog"] a.delete_at(99) #=> nil
Deletes every element of self
for which block evaluates to true
.
The array is changed instantly every time the block is called, not after the iteration is over.
See also Array#reject!
If no block is given, an Enumerator
is returned instead.
scores = [ 97, 42, 75 ] scores.delete_if {|score| score < 80 } #=> [97]
Passes elements to the block until the block returns nil
or false
, then stops iterating and returns an array of all prior elements.
If no block is given, an Enumerator
is returned instead.
See also Array#drop_while
a = [1, 2, 3, 4, 5, 0] a.take_while { |i| i < 3 } #=> [1, 2]
Drops elements up to, but not including, the first element for which the block returns nil
or false
and returns an array containing the remaining elements.
If no block is given, an Enumerator
is returned instead.
See also Array#take_while
a = [1, 2, 3, 4, 5, 0] a.drop_while {|i| i < 3 } #=> [3, 4, 5, 0]
Returns the list of private methods accessible to obj. If the all parameter is set to false
, only those methods in the receiver will be listed.
Returns the list of public methods accessible to obj. If the all parameter is set to false
, only those methods in the receiver will be listed.
Similar to method, searches public method only.
Returns the number of bits of the value of int.
“the number of bits” means that the bit position of the highest bit which is different to the sign bit. (The bit position of the bit 2**n is n+1.) If there is no such bit (zero or minus one), zero is returned.
I.e. This method returns ceil(log2(int < 0 ? -int : int+1)).
(-2**10000-1).bit_length #=> 10001 (-2**10000).bit_length #=> 10000 (-2**10000+1).bit_length #=> 10000 (-2**1000-1).bit_length #=> 1001 (-2**1000).bit_length #=> 1000 (-2**1000+1).bit_length #=> 1000 (-2**12-1).bit_length #=> 13 (-2**12).bit_length #=> 12 (-2**12+1).bit_length #=> 12 -0x101.bit_length #=> 9 -0x100.bit_length #=> 8 -0xff.bit_length #=> 8 -2.bit_length #=> 1 -1.bit_length #=> 0 0.bit_length #=> 0 1.bit_length #=> 1 0xff.bit_length #=> 8 0x100.bit_length #=> 9 (2**12-1).bit_length #=> 12 (2**12).bit_length #=> 13 (2**12+1).bit_length #=> 13 (2**1000-1).bit_length #=> 1000 (2**1000).bit_length #=> 1001 (2**1000+1).bit_length #=> 1001 (2**10000-1).bit_length #=> 10000 (2**10000).bit_length #=> 10001 (2**10000+1).bit_length #=> 10001
This method can be used to detect overflow in Array#pack
as follows.
if n.bit_length < 32 [n].pack("l") # no overflow else raise "overflow" end
Passes the Integer
ordinal of each character in str, also known as a codepoint when applied to Unicode strings to the given block.
If no block is given, an enumerator is returned instead.
"hello\u0639".each_codepoint {|c| print c, ' ' }
produces:
104 101 108 108 111 1593
Returns true
if the named file is readable by the real user and group id of this process. See access(3).