lib/sixarm_ruby_ramp/io.rb
# Read a line as with IO#readline and return the line as a row of fields.
#
# Note: the col option is sent along to String#split, so can be a string or a regexp.
#
# @return [Array<String>] fields
#
# @param [Hash] options
# - Rows are separated by _row_ option, which defaults to Ruby's record separator $/ or "\n" 
# - Cols are separated by _col_ option, which defaults to Ruby's string split separator $; or "\t"
#
# @example
#   file = File.new("my.tsv")
#   file.readrow() => ["A1","B1","C1"]
#   file.readrow() => ["A2","B2","C2"]
#   file.readrow() => ["A3","B3","C3"]]
#
# @example with options suitable for a file using TSV (Tab Separated Values)
#   file = File.new("my.tsv")
#   file.readrow(:row=>"\n", :col=>"\t") => ["A1","B1","C1"] 
#   file.readrow(:row=>"\n", :col=>"\t") => ["A2","B2","C2"] 
#   file.readrow(:row=>"\n", :col=>"\t") => ["A3","B3","C3"] 
#
# @see File#readline
# @see File#readlines
# @see File#readrows
Read a line as with IO#readline and return the line as a row of fields.
Note: the col option is sent along to String#split, so can be a string or a regexp.
Read a line as with IO#readline and return the line as a row of fields . Note : the col option is sent along to String#split so can be a string or a regexp .
def readrow(options={})
    row_sep||=options[:row]||$/||"\n"
    col_sep||=options[:col]||$;||"\t"
   return readline(row_sep).chomp(row_sep).split(col_sep)
  end
def readrow ( options = { } ) row_sep ||= options [ :row ] || $/ || "\n" col_sep ||= options [ :col ] || $; || "\t" return readline ( row_sep ) . chomp ( row_sep ) . split ( col_sep ) end
Read a line as with IO#readline and return the line as a row of fields.
Read a line as with IO#readline and return the line as a row of fields .
None
Array<String>
options
Rows are separated by _row_ option, which defaults to Ruby's record separator $/ or "\n" - Cols are separated by _col_ option, which defaults to Ruby's string split separator $; or "\t"
Rows are separated by _row_ option which defaults to Ruby ' s record separator $ / or " \ n " - Cols are separated by _col_ option which defaults to Ruby ' s string split separator $ ; or " \ t "
Ruby's string split separator $; or "\t"
example
None
example
None
see
None
see
None
see
None