[](*args) Class Public methods Returns a new array populated with the given objects. Array.[]( 1, 'a', /^A/ ) # => [1, "a", /^A/] Array[ 1, 'a', /^A/ ] # => [1, "a", /^A/] [ 1, 'a', /^A/ ] # => [1, "a", /^A/]
ARGF.write(string) â integer Instance Public methods Writes string if inplace mode.
ARGF.to_write_io â io Instance Public methods Returns IO instance tied to ARGF for writing if inplace mode is enabled.
ARGF.to_s â String Instance Public methods Returns âARGFâ. inspect
ARGF.to_io â IO Instance Public methods Returns an IO object representing the current file. This will be a File object unless the current file is a stream such as STDIN. For example: ARGF.to_io #=> #<File:glark.txt> ARGF.to_io #=> #<IO:<STDIN>>
ARGF.to_i â fixnum Instance Public methods 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
ARGF.to_a(sep=$/) â arrayARGF.to_a(limit) â arrayARGF.to_a(sep, limit) â array Instance Public methods 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"
ARGF.tell â Integer Instance Public methods Returns the current offset (in bytes) of the current file in ARGF. ARGF.pos #=> 0 ARGF.gets #=> "This is line one\n" ARGF.pos #=> 17
ARGF.skip â ARGF Instance Public methods Sets the current file to the next file in ARGV. If there aren't any more files it has no effect. For example: $ ruby argf.rb foo bar ARGF.filename #=> "foo" ARGF.skip ARGF.filename #=> "bar"
ARGF.set_encoding(ext_enc) â ARGFARGF.set_encoding("ext_enc:int_enc") â ARGFARGF.set_encoding(ext_enc, int_enc) â ARGFARGF.set_encoding("ext_enc:int_enc", opt) â ARGFARGF.set_encoding(ext_enc, int_enc, opt) â ARGF Instance Public methods If single argument is specified, strings read from ARGF are tagged with the encoding specified. If two encoding names separated by a colon are given, e.g. âascii:utf-8â, the read string is converted from the first encodi
Page 2261 of 2275