Results for: "to_proc"

No documentation available

Returns the name or string corresponding to sym.

:fred.id2name   #=> "fred"
:ginger.to_s    #=> "ginger"

Return the path as a String.

to_path is implemented so Pathname objects are usable with File.open, etc.

Returns a new Array containing each key-value pair in the database.

Example:

require 'sdbm'

SDBM.open 'my_database' do |db|
  db.update('apple' => 'fruit', 'spinach' => 'vegetable')

  db.to_a  #=> [["apple", "fruit"], ["spinach", "vegetable"]]
end

returns the socket address as packed struct sockaddr string.

Addrinfo.tcp("localhost", 80).to_sockaddr
#=> "\x02\x00\x00P\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00"

Returns self. If called on a subclass of Hash, converts the receiver to a Hash object.

If a block is given, the results of the block on each pair of the receiver will be used as pairs.

Converts hsh to a nested array of [ key, value ] arrays.

h = { "c" => 300, "a" => 100, "d" => 400, "c" => 300  }
h.to_a   #=> [["c", 300], ["a", 100], ["d", 400]]

Return the contents of this hash as a string.

h = { "c" => 300, "a" => 100, "d" => 400, "c" => 300  }
h.to_s   #=> "{\"c\"=>300, \"a\"=>100, \"d\"=>400}"

Converts the environment variables into an array of names and value arrays.

ENV.to_a # => [["TERM", "xterm-color"], ["SHELL", "/bin/bash"], ...]

Returns “ENV”

Creates a hash with a copy of the environment variables.

Returns “ARGF”.

Returns an integer representing the numeric file descriptor for the current file. Raises an ArgumentError if there isn’t a current file.

ARGF.fileno    #=> 3

Reads ARGF‘s current file in its entirety, returning an Array of its lines, one line per element. Lines are assumed to be separated by sep.

lines = ARGF.readlines
lines[0]                #=> "This is line one\n"
No documentation available

Returns the integer representation of the ipaddr.

Returns a string containing the IP address representation.

Returns an array of arrays that describe the rows of the matrix.

Overrides Object#to_s

Returns the elements of the vector in an array.

Overrides Object#to_s

No documentation available

Returns option summary list.

Returns the array of matches.

m = /(.)(.)(\d+)(\d)/.match("THX1138.")
m.to_a   #=> ["HX1138", "H", "X", "113", "8"]

Because to_a is called when expanding *variable, there’s a useful assignment shortcut for extracting matched fields. This is slightly slower than accessing the fields directly (as an intermediate array is generated).

all,f1,f2,f3 = * /(.)(.)(\d+)(\d)/.match("THX1138.")
all   #=> "HX1138"
f1    #=> "H"
f2    #=> "X"
f3    #=> "113"

Returns the entire matched string.

m = /(.)(.)(\d+)(\d)/.match("THX1138.")
m.to_s   #=> "HX1138"
Search took: 3ms  ·  Total Results: 2024