Class: Rafflesia::RelationArtifactData

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/rafflesia/cache/relation_artifact_data.rb

Constant Summary collapse

HASH_ATTRS =
{
  columns: :columns,
  content_hash: :content_hash,
  database: :database,
  object: :object,
  object_refs: :object_refs,
  preview: :preview,
  relation: :relation,
  release: :release,
  row_count: :row_count,
  schema_ref: :schema_ref
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ RelationArtifactData

Returns a new instance of RelationArtifactData.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rafflesia/cache/relation_artifact_data.rb', line 33

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @columns = (hash[:columns] || []).map { |item| item ? Rafflesia::TableColumn.new(item) : nil }
  @content_hash = hash[:content_hash]
  @database = hash[:database]
  @object = hash[:object]
  @object_refs = (hash[:object_refs] || [])
  @preview = hash[:preview] ? Rafflesia::RelationPreviewData.new(hash[:preview]) : nil
  @relation = hash[:relation]
  @release = hash[:release]
  @row_count = hash[:row_count]
  @schema_ref = hash[:schema_ref]
end

Instance Attribute Details

#columnsObject

Returns the value of attribute columns.



21
22
23
# File 'lib/rafflesia/cache/relation_artifact_data.rb', line 21

def columns
  @columns
end

#content_hashObject

Returns the value of attribute content_hash.



21
22
23
# File 'lib/rafflesia/cache/relation_artifact_data.rb', line 21

def content_hash
  @content_hash
end

#databaseObject

Returns the value of attribute database.



21
22
23
# File 'lib/rafflesia/cache/relation_artifact_data.rb', line 21

def database
  @database
end

#objectObject

Returns the value of attribute object.



21
22
23
# File 'lib/rafflesia/cache/relation_artifact_data.rb', line 21

def object
  @object
end

#object_refsObject

Returns the value of attribute object_refs.



21
22
23
# File 'lib/rafflesia/cache/relation_artifact_data.rb', line 21

def object_refs
  @object_refs
end

#previewObject

Returns the value of attribute preview.



21
22
23
# File 'lib/rafflesia/cache/relation_artifact_data.rb', line 21

def preview
  @preview
end

#relationObject

Returns the value of attribute relation.



21
22
23
# File 'lib/rafflesia/cache/relation_artifact_data.rb', line 21

def relation
  @relation
end

#releaseObject

Returns the value of attribute release.



21
22
23
# File 'lib/rafflesia/cache/relation_artifact_data.rb', line 21

def release
  @release
end

#row_countObject

Returns the value of attribute row_count.



21
22
23
# File 'lib/rafflesia/cache/relation_artifact_data.rb', line 21

def row_count
  @row_count
end

#schema_refObject

Returns the value of attribute schema_ref.



21
22
23
# File 'lib/rafflesia/cache/relation_artifact_data.rb', line 21

def schema_ref
  @schema_ref
end