Class: Roo::CSV

Inherits:
Base
  • Object
show all
Defined in:
lib/roo/csv.rb

Constant Summary

Constants inherited from Base

Base::MAX_ROW_COL, Base::MIN_ROW_COL

Instance Attribute Summary collapse

Attributes inherited from Base

#header_line, #headers

Instance Method Summary collapse

Methods inherited from Base

TEMP_PREFIX, #cell_type_by_value, #close, #collect_last_row_col_for_sheet, #column, #default_sheet, #default_sheet=, #each, #each_with_pagename, #empty?, finalize, #find, #first_column_as_letter, #first_last_row_col_for_sheet, #info, #initialize, #inspect, #last_column_as_letter, #method_missing, #parse, #reload, #row, #row_with, #set, #sheet

Methods included from Formatters::YAML

#to_yaml

Methods included from Formatters::XML

#to_xml

Methods included from Formatters::Matrix

#to_matrix

Methods included from Formatters::CSV

#to_csv

Methods included from Formatters::Base

#integer_to_timestring

Constructor Details

This class inherits a constructor from Roo::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Roo::Base

Instance Attribute Details

#filenameObject (readonly) Also known as: filename_or_stream

Returns the value of attribute filename.



16
17
18
# File 'lib/roo/csv.rb', line 16

def filename
  @filename
end

Instance Method Details

#cell(row, col, sheet = nil) ⇒ Object



24
25
26
27
28
# File 'lib/roo/csv.rb', line 24

def cell(row, col, sheet = nil)
  sheet ||= default_sheet
  read_cells(sheet)
  @cell[normalize(row, col)]
end

#cell_postprocessing(_row, _col, value) ⇒ Object



36
37
38
# File 'lib/roo/csv.rb', line 36

def cell_postprocessing(_row, _col, value)
  value
end

#celltype(row, col, sheet = nil) ⇒ Object



30
31
32
33
34
# File 'lib/roo/csv.rb', line 30

def celltype(row, col, sheet = nil)
  sheet ||= default_sheet
  read_cells(sheet)
  @cell_type[normalize(row, col)]
end

#csv_optionsObject



40
41
42
# File 'lib/roo/csv.rb', line 40

def csv_options
  @options[:csv_options] || {}
end

#set_type(row, col, type, _sheet) ⇒ Object



48
49
50
# File 'lib/roo/csv.rb', line 48

def set_type(row, col, type, _sheet)
  @cell_type[[row, col]] = type
end

#set_value(row, col, value, _sheet) ⇒ Object



44
45
46
# File 'lib/roo/csv.rb', line 44

def set_value(row, col, value, _sheet)
  @cell[[row, col]] = value
end

#sheetsObject

Returns an array with the names of the sheets. In CSV class there is only one dummy sheet, because a csv file cannot have more than one sheet.



20
21
22
# File 'lib/roo/csv.rb', line 20

def sheets
  ["default"]
end