class Spread2RDF::Mapping::Column
Public Class Methods
new(sheet, parent)
click to toggle source
Calls superclass method
# File lib/spread2rdf/mapping/column.rb, line 11 def initialize(sheet, parent) super @cells = {} map(row_range) end
Public Instance Methods
cell(coord)
click to toggle source
# File lib/spread2rdf/mapping/column.rb, line 50 def cell(coord) coord = cell_coord(coord) @cells[coord.to_sym] # TODO: search @sub_sheet_mappings also end
cell!(coord)
click to toggle source
# File lib/spread2rdf/mapping/column.rb, line 55 def cell!(coord) coord = cell_coord(coord) @cells[coord.to_sym] ||= Cell.new(schema, self, coord.row) end
cell_coord(row)
click to toggle source
# File lib/spread2rdf/mapping/column.rb, line 33 def cell_coord(row) case row when Integer then Coord[column: schema.coord, row: row] when Coord then Coord when Hash then Coord[row] else raise ArgumentError end end
cells()
click to toggle source
Mapping::Element
structure
# File lib/spread2rdf/mapping/column.rb, line 45 def cells @cells.values end
Also aliased as: _children_
map(range)
click to toggle source
# File lib/spread2rdf/mapping/column.rb, line 17 def map(range) #puts "mapping #{self} in #{range} ..." case range when Integer cell = cell!(range) statements_to_object(cell.object) unless cell.empty? when Range range.each { |row| self.map(row) } else raise ArgumentError end end
objects()
click to toggle source
# File lib/spread2rdf/mapping/column.rb, line 29 def objects cells.map(&:object) end