Obsolete: use subtype
instead. Calling this will generate a warning message to stderr
, then return the value of subtype
.
Obsolete: use subtype
instead. Calling this will generate a warning message to stderr
, then return the value of subtype
.
Obsolete: use subtype
instead. Calling this will generate a warning message to stderr
, then return the value of subtype
.
Obsolete: use subtype
instead. Calling this will generate a warning message to stderr
, then return the value of subtype
.
Returns true if other
is a subdomain.
Example:
domain = Resolv::DNS::Name.create("y.z") p Resolv::DNS::Name.create("w.x.y.z").subdomain_of?(domain) #=> true p Resolv::DNS::Name.create("x.y.z").subdomain_of?(domain) #=> true p Resolv::DNS::Name.create("y.z").subdomain_of?(domain) #=> false p Resolv::DNS::Name.create("z").subdomain_of?(domain) #=> false p Resolv::DNS::Name.create("x.y.z.").subdomain_of?(domain) #=> false p Resolv::DNS::Name.create("w.z").subdomain_of?(domain) #=> false
Returns whether self
‘s encoding is UTF-8 or not.
Returns the successor to str. The successor is calculated by incrementing characters starting from the rightmost alphanumeric (or the rightmost character if there are no alphanumerics) in the string. Incrementing a digit always results in another digit, and incrementing a letter results in another letter of the same case. Incrementing nonalphanumerics uses the underlying character set’s collating sequence.
If the increment generates a “carry,” the character to the left of it is incremented. This process repeats until there is no carry, adding an additional character if necessary.
"abcd".succ #=> "abce" "THX1138".succ #=> "THX1139" "<<koala>>".succ #=> "<<koalb>>" "1999zzz".succ #=> "2000aaa" "ZZZ9999".succ #=> "AAAA0000" "***".succ #=> "**+"
Equivalent to String#succ
, but modifies the receiver in place.
If the string is invalid byte sequence then replace invalid bytes with given replacement character, else returns self. If block is given, replace invalid bytes with returned value of the block.
"abc\u3042\x81".scrub #=> "abc\u3042\uFFFD" "abc\u3042\x81".scrub("*") #=> "abc\u3042*" "abc\u3042\xE3\x80".scrub{|bytes| '<'+bytes.unpack('H*')[0]+'>' } #=> "abc\u3042<e380>"
If the string is invalid byte sequence then replace invalid bytes with given replacement character, else returns self. If block is given, replace invalid bytes with returned value of the block.
"abc\u3042\x81".scrub! #=> "abc\u3042\uFFFD" "abc\u3042\x81".scrub!("*") #=> "abc\u3042*" "abc\u3042\xE3\x80".scrub!{|bytes| '<'+bytes.unpack('H*')[0]+'>' } #=> "abc\u3042<e380>"
Returns a basic n-bit checksum of the characters in str, where n is the optional Fixnum
parameter, defaulting to 16. The result is simply the sum of the binary value of each byte in str modulo 2**n - 1
. This is not a particularly good checksum.
Resumes the fiber from the point at which the last Fiber.yield
was called, or starts running it if it is the first call to resume
. Arguments passed to resume will be the value of the Fiber.yield
expression or will be passed as block parameters to the fiber’s block if this is the first resume
.
Alternatively, when resume is called it evaluates to the arguments passed to the next Fiber.yield
statement inside the fiber’s block or to the block value if it runs to completion without any Fiber.yield
Returns the return value of the iterator.
o = Object.new def o.each yield 1 yield 2 yield 3 100 end e = o.to_enum puts e.next #=> 1 puts e.next #=> 2 puts e.next #=> 3 begin e.next rescue StopIteration => ex puts ex.result #=> 100 end
Returns true
if exiting successful, false
if not.
Return the arguments passed in as the third parameter to the constructor.
With no arguments, sets the default visibility for subsequently defined methods to public. With arguments, sets the named methods to have public visibility. String arguments are converted to symbols.
Returns the Integer
equal to int
+ 1, same as Fixnum#next
.
1.next #=> 2 (-1).next #=> 0
Returns true if the date is Sunday.
Returns a date object denoting the following day.
Returns a new Time
object, one second later than time. Time#succ
is obsolete since 1.9.2 for time is not a discrete value.
t = Time.now #=> 2007-11-19 08:23:57 -0600 t.succ #=> 2007-11-19 08:23:58 -0600
Use instead time + 1
t + 1 #=> 2007-11-19 08:23:58 -0600
Returns true
if time represents Sunday.
t = Time.local(1990, 4, 1) #=> 1990-04-01 00:00:00 -0600 t.sunday? #=> true
Returns the superclass of class, or nil
.
File.superclass #=> IO IO.superclass #=> Object Object.superclass #=> BasicObject class Foo; end class Bar < Foo; end Bar.superclass #=> Foo
Returns nil when the given class does not have a parent class:
BasicObject.superclass #=> nil