Class: ActiveElement::JsonFieldSchema

Inherits:
Object
  • Object
show all
Defined in:
lib/active_element/json_field_schema.rb

Overview

Generates a schema for a JSON form field based on values stored in the database.

Instance Method Summary collapse

Constructor Details

#initialize(table:, column:) ⇒ JsonFieldSchema

Returns a new instance of JsonFieldSchema.



6
7
8
9
# File 'lib/active_element/json_field_schema.rb', line 6

def initialize(table:, column:)
  @table = table
  @column = column
end

Instance Method Details

#schemaObject



11
12
13
# File 'lib/active_element/json_field_schema.rb', line 11

def schema
  data.map { |datum| structure(datum) }
end