Class: Schema
- Inherits:
-
Struct
- Object
- Struct
- Schema
- Defined in:
- lib/schema.rb
Instance Attribute Summary collapse
-
#stream ⇒ Object
Returns the value of attribute stream.
Instance Method Summary collapse
- #datetime(name) ⇒ Object
- #properties ⇒ Object
- #string(name, options = {}) ⇒ Object
- #timestamps ⇒ Object
- #to_hash ⇒ Object
Instance Attribute Details
#stream ⇒ Object
Returns the value of attribute stream
2 3 4 |
# File 'lib/schema.rb', line 2 def stream @stream end |
Instance Method Details
#datetime(name) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/schema.rb', line 11 def datetime(name) properties[name.to_sym] = { type: [:string, :null], format: 'date-time' } end |
#properties ⇒ Object
23 24 25 |
# File 'lib/schema.rb', line 23 def properties @properties ||= {} end |
#string(name, options = {}) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/schema.rb', line 3 def string(name, ={}) if [:nil] properties[name.to_sym] = { type: [:string, :null] } else properties[name.to_sym] = { type: :string } end end |
#timestamps ⇒ Object
18 19 20 21 |
# File 'lib/schema.rb', line 18 def datetime :created_at datetime :updated_at end |
#to_hash ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/schema.rb', line 27 def to_hash { type: :SCHEMA, stream: stream, key_properties: [:id], schema: { properties: properties } } end |