Module: Inquery::Mixins::SchemaValidation::ClassMethods

Defined in:
lib/inquery/mixins/schema_validation.rb

Instance Method Summary collapse

Instance Method Details

#schema(schema) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/inquery/mixins/schema_validation.rb', line 12

def schema(schema)
  fail 'Schema must be a hash.' unless schema.is_a?(Hash)

  unless schema[:type]
    schema = {
      type: :hash,
      hash: schema
    }
  end

  self._schema = schema
end