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"
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
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"
Converts the set to an array. The order of elements is uncertain.
Set[1, 2].to_a #=> [1, 2] Set[1, 'c', :s].to_a #=> [1, "c", :s]
The string representation of true
is “true”.
The string representation of false
is “false”.
Dump the name, id, and status of thr to a string.
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]
Returns the result of interpreting enum as a list of [key, value]
pairs.
%i[hello world].each_with_index.to_h # => {:hello => 0, :world => 1}
Returns self
.