Results for: "to_proc"

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"

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"

Returns the value of int as a BigDecimal.

require 'bigdecimal'
require 'bigdecimal/util'

42.to_d   # => 0.42e2

See also BigDecimal::new.

Returns a string containing the representation of int radix base (between 2 and 36).

12345.to_s       #=> "12345"
12345.to_s(2)    #=> "11000000111001"
12345.to_s(8)    #=> "30071"
12345.to_s(10)   #=> "12345"
12345.to_s(16)   #=> "3039"
12345.to_s(36)   #=> "9ix"
78546939656932.to_s(36)  #=> "rubyrules"

As int is already an Integer, all these methods simply return the receiver.

Synonyms is to_int

Converts int to a Float. If int doesn’t fit in a Float, the result is infinity.

Returns the value as a rational.

1.to_r        #=> (1/1)
(1<<64).to_r  #=> (18446744073709551616/1)

Converts the set to an array. The order of elements is uncertain.

The string representation of true is “true”.

‘nuf said…

Returns the name of the underlying method.

"cat".method(:count).inspect   #=> "#<Method: String#count>"

Returns the name of the underlying method.

"cat".method(:count).inspect   #=> "#<Method: String#count>"

Returns formatted message with the inspected tag.

Returns an array containing the items in enum.

(1..7).to_a                       #=> [1, 2, 3, 4, 5, 6, 7]
{ 'a'=>1, 'b'=>2, 'c'=>3 }.to_a   #=> [["a", 1], ["b", 2], ["c", 3]]

require 'prime'
Prime.entries 10                  #=> [2, 3, 5, 7]
Search took: 1ms  ·  Total Results: 1871