Class: Spread2RDF::Mapping::Cell

Inherits:
Element
  • Object
show all
Includes:
ResourceCreation
Defined in:
lib/spread2rdf/mapping/cell.rb,
lib/spread2rdf/mapping/default_cell_mappings.rb

Defined Under Namespace

Modules: Default

Instance Attribute Summary collapse

Attributes inherited from Element

#parent, #schema

Instance Method Summary collapse

Methods included from ResourceCreation

#create_resource

Methods inherited from Element

#graph, #to_s

Constructor Details

#initialize(sheet, parent, row) ⇒ Cell

Returns a new instance of Cell.



11
12
13
14
15
# File 'lib/spread2rdf/mapping/cell.rb', line 11

def initialize(sheet, parent, row)
  super(sheet, parent)
  @row = row
  map
end

Instance Attribute Details

#rowObject (readonly)

Returns the value of attribute row.



6
7
8
# File 'lib/spread2rdf/mapping/cell.rb', line 6

def row
  @row
end

Instance Method Details

#_children_Object



128
129
130
# File 'lib/spread2rdf/mapping/cell.rb', line 128

def _children_
  nil
end

#coordObject



21
22
23
# File 'lib/spread2rdf/mapping/cell.rb', line 21

def coord
  Coord[column: schema.coord, row: row]
end

#empty?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/spread2rdf/mapping/cell.rb', line 34

def empty?
  value.blank?
end

#mapObject



17
18
19
# File 'lib/spread2rdf/mapping/cell.rb', line 17

def map
  exec(&schema.block) unless empty?
end

#objectObject



30
31
32
# File 'lib/spread2rdf/mapping/cell.rb', line 30

def object
  @object ||= value && map_to_object(value)
end

#valueObject Also known as: resource_creation_value



25
26
27
# File 'lib/spread2rdf/mapping/cell.rb', line 25

def value
  @value ||= worksheet.cell_value(coord)
end