Class: Retab::ReconstructSubdocument

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

Constant Summary collapse

HASH_ATTRS =
{
  enrichment: :enrichment,
  name: :name,
  partition_key: :partition_key,
  regions: :regions
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ ReconstructSubdocument

Returns a new instance of ReconstructSubdocument.



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

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @enrichment = hash[:enrichment] ? Retab::ReconstructEnrichmentOptions.new(hash[:enrichment]) : nil
  @name = hash[:name]
  @partition_key = hash[:partition_key]
  @regions = (hash[:regions] || []).map { |item| item ? Retab::SheetRegion.new(item) : nil }
end

Instance Attribute Details

#enrichmentObject

Returns the value of attribute enrichment.



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

def enrichment
  @enrichment
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#partition_keyObject

Returns the value of attribute partition_key.



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

def partition_key
  @partition_key
end

#regionsObject

Returns the value of attribute regions.



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

def regions
  @regions
end