Returns true if the given ordinal date is valid, and false if not.
Date.valid_ordinal?(2001,34) #=> true Date.valid_ordinal?(2001,366) #=> false
Returns true if the given calendar date is valid, and false if not.
Date.valid_date?(2001,2,3) #=> true Date.valid_date?(2001,2,29) #=> false
Returns true if the given week date is valid, and false if not.
Date.valid_commercial?(2001,5,6) #=> true Date.valid_commercial?(2001,5,8) #=> false
See also ::jd
and ::commercial
.
Returns a Time
object which denotes self.
Returns self.
Deserializes JSON
string by converting Julian year y
, month m
, day d
and Day of Calendar Reform sg
to Date
.
Returns a Time
object which denotes self.
Returns a Date
object which denotes self.
Deserializes JSON
string by converting year y
, month m
, day d
, hour H
, minute M
, second S
, offset of
and Day of Calendar Reform sg
to DateTime
.
Returns self.
Returns a Date
object which denotes self.
Returns an array containing the values associated with the given keys.
Calls the block once for each [key, value] pair in the database. Returns self.
Yields the name and value of each struct member in order. If no block is given an enumerator is returned.
Customer = Struct.new(:name, :address, :zip) joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) joe.each_pair {|name, value| puts("#{name} => #{value}") }
Produces:
name => Joe Smith address => 123 Maple, Anytown NC zip => 12345
Returns the struct member values for each selector
as an Array. A selector
may be either an Integer
offset or a Range
of offsets (as in Array#values_at
).
Customer = Struct.new(:name, :address, :zip) joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) joe.values_at(0, 2) #=> ["Joe Smith", 12345]
IO.copy_stream
copies src to dst. src and dst is either a filename or an IO-like object. IO-like object for src should have readpartial
or read
method. IO-like object for dst should have write
method. (Specialized mechanisms, such as sendfile system call, may be used on appropriate situation.)
This method returns the number of bytes copied.
If optional arguments are not given, the start position of the copy is the beginning of the filename or the current file offset of the IO
. The end position of the copy is the end of file.
If copy_length is given, No more than copy_length bytes are copied.
If src_offset is given, it specifies the start position of the copy.
When src_offset is specified and src is an IO
, IO.copy_stream
doesn’t move the current file offset.
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
.
Returns an array of the values associated with each specified key.