Class: Super::Schema

Inherits:
Object
  • Object
show all
Defined in:
lib/super/schema.rb

Overview

The Schema is a general purpose container for describing the “schema” for various purposes. It primarily exists to provide a cohesive user-facing API for defining schemas.

The various “schema types” are likely of more interest

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema_type) ⇒ Schema

Returns a new instance of Schema.

Parameters:



9
10
11
12
13
14
15
16
# File 'lib/super/schema.rb', line 9

def initialize(schema_type)
  @schema_type = schema_type
  @fields = {}

  if block_given?
    yield(@fields, @schema_type)
  end
end

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields.



18
19
20
# File 'lib/super/schema.rb', line 18

def fields
  @fields
end

Instance Method Details

#field_keysObject



20
21
22
# File 'lib/super/schema.rb', line 20

def field_keys
  fields.keys
end