Results for: "fnmatch"

Deserializes JSON string by converting numerator value n, denominator value d, to a Rational object.

Return the accept character set for all new CGI instances.

Set the accept character set for all new CGI instances.

Returns true if the given calendar date is valid, and false if not. Valid in this context is whether the arguments passed to this method would be accepted by ::new.

Date.valid_date?(2001,2,3)        #=> true
Date.valid_date?(2001,2,29)       #=> false
Date.valid_date?(2001,2,-1)       #=> true

See also ::jd and ::civil.

Returns self.

Returns a DateTime object which denotes self.

Deserializes JSON string by converting Julian year y, month m, day d and Day of Calendar Reform sg to Date.

Returns a Date object which denotes self.

Returns 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 a Date object which denotes self.

Returns a DateTime object which denotes self.

Deserializes JSON string by converting time since epoch to Time

Returns the offset in seconds between the timezone of time and UTC.

t = Time.gm(2000,1,1,20,15,1)   #=> 2000-01-01 20:15:01 UTC
t.gmt_offset                    #=> 0
l = t.getlocal                  #=> 2000-01-01 14:15:01 -0600
l.gmt_offset                    #=> -21600

Deserializes JSON string by constructing new Struct object with values v serialized by to_json.

Calls the given block with each member name/value pair; returns self:

Customer = Struct.new(:name, :address, :zip) # => Customer
joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
joe.each_pair {|(name, value)| p "#{name} => #{value}" }

Output:

"name => Joe Smith"
"address => 123 Maple, Anytown NC"
"zip => 12345"

Returns an Enumerator if no block is given.

Related: each.

Returns an array of values from self.

With integer arguments integers given, returns an array containing each value given by one of integers:

Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
joe.values_at(0, 2)    # => ["Joe Smith", 12345]
joe.values_at(2, 0)    # => [12345, "Joe Smith"]
joe.values_at(2, 1, 0) # => [12345, "123 Maple, Anytown NC", "Joe Smith"]
joe.values_at(0, -3)   # => ["Joe Smith", "Joe Smith"]

Raises IndexError if any of integers is out of range; see Array Indexes.

With integer range argument integer_range given, returns an array containing each value given by the elements of the range; fills with nil values for range elements larger than the structure:

joe.values_at(0..2)
# => ["Joe Smith", "123 Maple, Anytown NC", 12345]
joe.values_at(-3..-1)
# => ["Joe Smith", "123 Maple, Anytown NC", 12345]
joe.values_at(1..4) # => ["123 Maple, Anytown NC", 12345, nil, nil]

Raises RangeError if any element of the range is negative and out of range; see Array Indexes.

Executes the block for every line in ios, where lines are separated by sep. ios must be opened for reading or an IOError will be raised.

If no block is given, an enumerator is returned instead.

f = File.new("testfile")
f.each {|line| puts "#{f.lineno}: #{line}" }

produces:

1: This is line one
2: This is line two
3: This is line three
4: And so on...

See IO.readlines for details about getline_args.

Calls the given block once for each byte (0..255) in ios, passing the byte as an argument. The stream must be opened for reading or an IOError will be raised.

If no block is given, an enumerator is returned instead.

f = File.new("testfile")
checksum = 0
f.each_byte {|x| checksum ^= x }   #=> #<File:testfile>
checksum                           #=> 12

Passes the Integer ordinal of each character in ios, passing the codepoint as an argument. The stream must be opened for reading or an IOError will be raised.

If no block is given, an enumerator is returned instead.

Deserializes JSON string by constructing new Struct object with values t serialized by to_json.

Yields all attributes (as symbols) along with the corresponding values or returns an enumerator if no block is given.

require "ostruct"
data = OpenStruct.new("country" => "Australia", :capital => "Canberra")
data.each_pair.to_a   # => [[:country, "Australia"], [:capital, "Canberra"]]

Deserializes JSON string by constructing new Range object with arguments a serialized by to_json.

Deserializes JSON string by constructing new Regexp object with source s (Regexp or String) and options o serialized by to_json

Import a JSON Marshalled object.

method used for JSON marshalling support.

Search took: 5ms  ·  Total Results: 1804