Class: Super::Schema
- Inherits:
-
Object
- Object
- Super::Schema
- 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
Defined Under Namespace
Classes: Fields
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
Instance Method Summary collapse
- #field_keys ⇒ Object
-
#initialize(schema_type) ⇒ Schema
constructor
A new instance of Schema.
Constructor Details
#initialize(schema_type) ⇒ Schema
Returns a new instance of Schema.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/super/schema.rb', line 9 def initialize(schema_type) @schema_type = schema_type @fields = Fields.new if @schema_type.respond_to?(:setup) @schema_type.setup(fields: @fields) end if block_given? yield(@fields, @schema_type) end end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
22 23 24 |
# File 'lib/super/schema.rb', line 22 def fields @fields end |
Instance Method Details
#field_keys ⇒ Object
24 25 26 |
# File 'lib/super/schema.rb', line 24 def field_keys fields.keys end |