Class: Retab::ReconstructEnrichedTable

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/retab/splits/reconstruct_enriched_table.rb

Constant Summary collapse

HASH_ATTRS =
{
  csv: :csv,
  header: :header,
  label: :label,
  rows: :rows
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ ReconstructEnrichedTable

Returns a new instance of ReconstructEnrichedTable.



22
23
24
25
26
27
28
29
# File 'lib/retab/splits/reconstruct_enriched_table.rb', line 22

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @csv = hash[:csv]
  @header = (hash[:header] || [])
  @label = hash[:label]
  @rows = (hash[:rows] || []).map { |item| item ? Retab::ReconstructEnrichedRow.new(item) : nil }
end

Instance Attribute Details

#csvObject

Returns the value of attribute csv.



15
16
17
# File 'lib/retab/splits/reconstruct_enriched_table.rb', line 15

def csv
  @csv
end

#headerObject

Returns the value of attribute header.



15
16
17
# File 'lib/retab/splits/reconstruct_enriched_table.rb', line 15

def header
  @header
end

#labelObject

Returns the value of attribute label.



15
16
17
# File 'lib/retab/splits/reconstruct_enriched_table.rb', line 15

def label
  @label
end

#rowsObject

Returns the value of attribute rows.



15
16
17
# File 'lib/retab/splits/reconstruct_enriched_table.rb', line 15

def rows
  @rows
end