Results for: "Dir.chdir"

Creates a DateTime object denoting the given ordinal date.

DateTime.ordinal(2001,34) #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...>
DateTime.ordinal(2001,34,4,5,6,'+7')
                          #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
DateTime.ordinal(2001,-332,-20,-55,-54,'+7')
                          #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>

Extracts the nested value specified by the sequence of key objects by calling dig at each step, returning nil if any intermediate step is nil.

Foo = Struct.new(:a)
f = Foo.new(Foo.new({b: [1, 2, 3]}))

f.dig(:a, :a, :b, 0)    # => 1
f.dig(:b, 0)            # => nil
f.dig(:a, :a, :b, :c)   # TypeError: no implicit conversion of Symbol into Integer

Extracts the nested value specified by the sequence of name objects by calling dig at each step, returning nil if any intermediate step is nil.

require "ostruct"
address = OpenStruct.new("city" => "Anytown NC", "zip" => 12345)
person  = OpenStruct.new("name" => "John Smith", "address" => address)

person.dig(:address, "zip")            # => 12345
person.dig(:business_address, "zip")   # => nil

data = OpenStruct.new(:array => [1, [2, 3]])

data.dig(:array, 1, 0)   # => 2
data.dig(:array, 0, 0)   # TypeError: Integer does not have #dig method

Returns the first object in the range, or an array of the first n elements.

(10..20).first     #=> 10
(10..20).first(3)  #=> [10, 11, 12]

Returns the Encoding object that represents the encoding of obj.

Returns the Encoding object that represents the encoding of sym.

Returns the birth time for the file. If the platform doesn’t have birthtime, raises NotImplementedError.

See File.birthtime.

Return encoding of the source.

Creates a pair of sockets connected each other.

domain should be a communications domain such as: :INET, :INET6, :UNIX, etc.

socktype should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.

protocol should be a protocol defined in the domain, defaults to 0 for the domain.

s1, s2 = Socket.pair(:UNIX, :STREAM, 0)
s1.send "a", 0
s1.send "b", 0
s1.close
p s2.recv(10) #=> "ab"
p s2.recv(10) #=> ""
p s2.recv(10) #=> ""

s1, s2 = Socket.pair(:UNIX, :DGRAM, 0)
s1.send "a", 0
s1.send "b", 0
p s2.recv(10) #=> "a"
p s2.recv(10) #=> "b"

Creates a pair of sockets connected each other.

domain should be a communications domain such as: :INET, :INET6, :UNIX, etc.

socktype should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.

protocol should be a protocol defined in the domain, defaults to 0 for the domain.

s1, s2 = Socket.pair(:UNIX, :STREAM, 0)
s1.send "a", 0
s1.send "b", 0
s1.close
p s2.recv(10) #=> "ab"
p s2.recv(10) #=> ""
p s2.recv(10) #=> ""

s1, s2 = Socket.pair(:UNIX, :DGRAM, 0)
s1.send "a", 0
s1.send "b", 0
p s2.recv(10) #=> "a"
p s2.recv(10) #=> "b"

Creates a pair of sockets connected to each other.

socktype should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.

protocol should be a protocol defined in the domain. 0 is default protocol for the domain.

s1, s2 = UNIXSocket.pair
s1.send "a", 0
s1.send "b", 0
p s2.recv(10) #=> "ab"

Creates a pair of sockets connected to each other.

socktype should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.

protocol should be a protocol defined in the domain. 0 is default protocol for the domain.

s1, s2 = UNIXSocket.pair
s1.send "a", 0
s1.send "b", 0
p s2.recv(10) #=> "ab"

Returns dispatch ID.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE_METHOD.new(tobj, 'Add')
puts method.dispid # => 181

Extracts the nested value specified by the sequence of key objects by calling dig at each step, returning nil if any intermediate step is nil.

h = { foo: {bar: {baz: 1}}}

h.dig(:foo, :bar, :baz)     #=> 1
h.dig(:foo, :zot, :xyz)     #=> nil

g = { foo: [10, 11, 12] }
g.dig(:foo, 1)              #=> 11
g.dig(:foo, 1, 0)           #=> TypeError: Integer does not have #dig method
g.dig(:foo, :bar)           #=> TypeError: no implicit conversion of Symbol into Integer

Synonym for $stdin.

Returns the display expression list

See DEBUGGER__ for more usage

Creates a matrix where the diagonal elements are composed of values.

Matrix.diagonal(9, 5, -3)
  =>  9  0  0
      0  5  0
      0  0 -3

Returns true if this is a diagonal matrix. Raises an error if matrix is not square.

No documentation available

Parses environment variable env or its uppercase with splitting like a shell.

env defaults to the basename of the program.

Performs integer division: returns integer result of dividing int by numeric.

See Numeric#divmod.

Returns the floating point result of dividing integer by numeric.

654321.fdiv(13731)      #=> 47.6528293642124
654321.fdiv(13731.24)   #=> 47.6519964693647

-1234567890987654321.fdiv(13731)      #=> -89910996357705.5
-1234567890987654321.fdiv(13731.24)   #=> -89909424858035.7

Returns the array including the digits extracted by place-value notation with radix base of int.

base should be greater than or equal to 2.

12345.digits      #=> [5, 4, 3, 2, 1]
12345.digits(7)   #=> [4, 6, 6, 0, 5]
12345.digits(100) #=> [45, 23, 1]

-12345.digits(7)  #=> Math::DomainError

Returns true if the set and the given set have no element in common. This method is the opposite of intersect?.

e.g.:

require 'set'
Set[1, 2, 3].disjoint? Set[3, 4] # => false
Set[1, 2, 3].disjoint? Set[4, 5] # => true
Search took: 5ms  ·  Total Results: 1136