Class: Rafflesia::RelationPreviewData
- Inherits:
-
Types::BaseModel
- Object
- Types::BaseModel
- Rafflesia::RelationPreviewData
- Defined in:
- lib/rafflesia/cache/relation_preview_data.rb
Constant Summary collapse
- HASH_ATTRS =
{ columns: :columns, content_hash: :content_hash, database: :database, engine: :engine, limit: :limit, order_by: :order_by, relation: :relation, release: :release, returned_row_count: :returned_row_count, row_count: :row_count, rows: :rows, schema_columns: :schema_columns, schema_ref: :schema_ref }.freeze
Instance Attribute Summary collapse
-
#columns ⇒ Object
Returns the value of attribute columns.
-
#content_hash ⇒ Object
Returns the value of attribute content_hash.
-
#database ⇒ Object
Returns the value of attribute database.
-
#engine ⇒ Object
Returns the value of attribute engine.
-
#limit ⇒ Object
Returns the value of attribute limit.
-
#order_by ⇒ Object
Returns the value of attribute order_by.
-
#relation ⇒ Object
Returns the value of attribute relation.
-
#release ⇒ Object
Returns the value of attribute release.
-
#returned_row_count ⇒ Object
Returns the value of attribute returned_row_count.
-
#row_count ⇒ Object
Returns the value of attribute row_count.
-
#rows ⇒ Object
Returns the value of attribute rows.
-
#schema_columns ⇒ Object
Returns the value of attribute schema_columns.
-
#schema_ref ⇒ Object
Returns the value of attribute schema_ref.
Instance Method Summary collapse
-
#initialize(json) ⇒ RelationPreviewData
constructor
A new instance of RelationPreviewData.
Constructor Details
#initialize(json) ⇒ RelationPreviewData
Returns a new instance of RelationPreviewData.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/rafflesia/cache/relation_preview_data.rb', line 39 def initialize(json) super() hash = self.class.normalize(json) @columns = (hash[:columns] || []) @content_hash = hash[:content_hash] @database = hash[:database] @engine = hash[:engine] @limit = hash[:limit] @order_by = (hash[:order_by] || []) @relation = hash[:relation] @release = hash[:release] @returned_row_count = hash[:returned_row_count] @row_count = hash[:row_count] @rows = (hash[:rows] || []).map { |item| item || {} } @schema_columns = (hash[:schema_columns] || []).map { |item| item ? Rafflesia::TableColumn.new(item) : nil } @schema_ref = hash[:schema_ref] end |
Instance Attribute Details
#columns ⇒ Object
Returns the value of attribute columns.
24 25 26 |
# File 'lib/rafflesia/cache/relation_preview_data.rb', line 24 def columns @columns end |
#content_hash ⇒ Object
Returns the value of attribute content_hash.
24 25 26 |
# File 'lib/rafflesia/cache/relation_preview_data.rb', line 24 def content_hash @content_hash end |
#database ⇒ Object
Returns the value of attribute database.
24 25 26 |
# File 'lib/rafflesia/cache/relation_preview_data.rb', line 24 def database @database end |
#engine ⇒ Object
Returns the value of attribute engine.
24 25 26 |
# File 'lib/rafflesia/cache/relation_preview_data.rb', line 24 def engine @engine end |
#limit ⇒ Object
Returns the value of attribute limit.
24 25 26 |
# File 'lib/rafflesia/cache/relation_preview_data.rb', line 24 def limit @limit end |
#order_by ⇒ Object
Returns the value of attribute order_by.
24 25 26 |
# File 'lib/rafflesia/cache/relation_preview_data.rb', line 24 def order_by @order_by end |
#relation ⇒ Object
Returns the value of attribute relation.
24 25 26 |
# File 'lib/rafflesia/cache/relation_preview_data.rb', line 24 def relation @relation end |
#release ⇒ Object
Returns the value of attribute release.
24 25 26 |
# File 'lib/rafflesia/cache/relation_preview_data.rb', line 24 def release @release end |
#returned_row_count ⇒ Object
Returns the value of attribute returned_row_count.
24 25 26 |
# File 'lib/rafflesia/cache/relation_preview_data.rb', line 24 def returned_row_count @returned_row_count end |
#row_count ⇒ Object
Returns the value of attribute row_count.
24 25 26 |
# File 'lib/rafflesia/cache/relation_preview_data.rb', line 24 def row_count @row_count end |
#rows ⇒ Object
Returns the value of attribute rows.
24 25 26 |
# File 'lib/rafflesia/cache/relation_preview_data.rb', line 24 def rows @rows end |
#schema_columns ⇒ Object
Returns the value of attribute schema_columns.
24 25 26 |
# File 'lib/rafflesia/cache/relation_preview_data.rb', line 24 def schema_columns @schema_columns end |
#schema_ref ⇒ Object
Returns the value of attribute schema_ref.
24 25 26 |
# File 'lib/rafflesia/cache/relation_preview_data.rb', line 24 def schema_ref @schema_ref end |