CSVLine

Class/Module:
Class
In:
lib/csvparser.rb
Parent:
DelegateClass(Array)

Description

CSVLine is a class to manage CSV line. Instance methods of Array delegates to fields attribute.

Methods

==
escape
new
to_s

Attributes

fields [RW]

Array of CSV fields.

Public Class Methods

escape( string, enquote = false, sepalator = ',' )

Returns a string escaped CSV control characters(double quotes and returns). If enquote is true, the string are enclosed with double quotes. Or the string are enclosed when it includes CSV control characters or the sepalator.

new( array = [] )

Generates an instance with the array as fields.

Public Instance Methods

==( csvline )

Returns true if self is equal to the CSVLine object.

to_s( enquote = false, sepalator = ',' )

Returns a string converted to CSV format with the sepalator. If enquote is true, each fields are enclosed with double quotes.