The default mail submission port number, 587.
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
When no block is given, returns the object equivalent to:
sum = init array.each {|element| sum += element } sum
For example, [e1, e2, e3].sum
returns </tt>init + e1 + e2 + e3</tt>.
Examples:
a = [0, 1, 2, 3] a.sum # => 6 a.sum(100) # => 106
The elements need not be numeric, but must be +
-compatible with each other and with init
:
a = ['abc', 'def', 'ghi'] a.sum('jkl') # => "jklabcdefghi"
When a block is given, it is called with each element and the block’s return value (instead of the element itself) is used as the addend:
a = ['zero', 1, :two] s = a.sum('Coerced and concatenated: ') {|element| element.to_s } s # => "Coerced and concatenated: zero1two"
Notes:
Array#join
and Array#flatten
may be faster than Array#sum
for an Array of Strings or an Array of Arrays.
Array#sum
method may not respect method redefinition of “+” methods such as Integer#+
.
Returns the successor of int
, i.e. the Integer
equal to int+1
.
1.next #=> 2 (-1).next #=> 0 1.succ #=> 2 (-1).succ #=> 0
Returns whether self
‘s encoding is UTF-8 or not.
Returns the successor to self
. The successor is calculated by incrementing characters.
The first character to be incremented is the rightmost alphanumeric: or, if no alphanumerics, the rightmost character:
'THX1138'.succ # => "THX1139" '<<koala>>'.succ # => "<<koalb>>" '***'.succ # => '**+'
The successor to a digit is another digit, “carrying” to the next-left character for a “rollover” from 9 to 0, and prepending another digit if necessary:
'00'.succ # => "01" '09'.succ # => "10" '99'.succ # => "100"
The successor to a letter is another letter of the same case, carrying to the next-left character for a rollover, and prepending another same-case letter if necessary:
'aa'.succ # => "ab" 'az'.succ # => "ba" 'zz'.succ # => "aaa" 'AA'.succ # => "AB" 'AZ'.succ # => "BA" 'ZZ'.succ # => "AAA"
The successor to a non-alphanumeric character is the next character in the underlying character set’s collating sequence, carrying to the next-left character for a rollover, and prepending another character if necessary:
s = 0.chr * 3 s # => "\x00\x00\x00" s.succ # => "\x00\x00\x01" s = 255.chr * 3 s # => "\xFF\xFF\xFF" s.succ # => "\x01\x00\x00\x00"
Carrying can occur between and among mixtures of alphanumeric characters:
s = 'zz99zz99' s.succ # => "aaa00aa00" s = '99zz99zz' s.succ # => "100aa00aa"
The successor to an empty String is a new empty String:
''.succ # => ""
String#next
is an alias for String#succ
.
Equivalent to String#succ
, but modifies self
in place; returns self
.
String#next!
is an alias for String#succ!
.
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 Integer
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. An Array
of Symbols and/or Strings are also accepted.
Returns true if the date is Sunday.
Returns a date object denoting the following day.
Returns true
if time represents Sunday.
t = Time.local(1990, 4, 1) #=> 1990-04-01 00:00:00 -0600 t.sunday? #=> true