Returns a new hash created by using environment variable names as values and values as names.
Returns the contents of the environment as a String
.
Deprecated method that is equivalent to ENV.key
Returns the number of environment variables.
Returns true
if there is an environment variable with the given name
.
This is a deprecated alias for each_line
.
This is a deprecated alias for each_codepoint
.
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 next line from the current file in ARGF
.
By default lines are assumed to be separated by $/
; to use a different character as a separator, supply it as a String
for the sep argument.
The optional limit argument specifies how many characters of each line to return. By default all characters are returned.
An EOFError
is raised at the end of the file.
Positions the current file to the beginning of input, resetting ARGF.lineno
to zero.
ARGF.readline #=> "This is line one\n" ARGF.rewind #=> 0 ARGF.lineno #=> 0 ARGF.readline #=> "This is line one\n"
Puts ARGF
into binary mode. Once a stream is in binary mode, it cannot be reset to non-binary mode. This option has the following effects:
Newline conversion is disabled.
Encoding
conversion is disabled.
Content is treated as ASCII-8BIT.
Returns true if ARGF
is being read in binary mode; false otherwise. To enable binary mode use ARGF.binmode
.
For example:
ARGF.binmode? #=> false ARGF.binmode ARGF.binmode? #=> true
Writes string if inplace mode.
Returns the current line number of ARGF
as a whole. This value can be set manually with ARGF.lineno=
.
For example:
ARGF.lineno #=> 0 ARGF.readline #=> "This is line 1\n" ARGF.lineno #=> 1
Sets the line number of ARGF
as a whole to the given Integer
.
ARGF
sets the line number automatically as you read data, so normally you will not need to set it explicitly. To access the current line number use ARGF.lineno
.
For example:
ARGF.lineno #=> 0 ARGF.readline #=> "This is line 1\n" ARGF.lineno #=> 1 ARGF.lineno = 0 #=> 0 ARGF.lineno #=> 0
Returns “ARGF”.
Synonym for $stdout.
Alias for CSV::read()
.
The line number of the last row read from this file. Fields with nested line-end characters will not affect this count.
The last row read from this file.
Rewinds the underlying IO
object and resets CSV’s lineno() counter.