Module: Neuron::Schema::Common::ClassMethods
- Defined in:
- lib/neuron-client/schema/common.rb
Instance Method Summary collapse
Instance Method Details
#schema ⇒ Object
9 10 11 |
# File 'lib/neuron-client/schema/common.rb', line 9 def schema @schema ||= "#{self.name}::SCHEMA".constantize end |
#validate!(schema_name, data) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/neuron-client/schema/common.rb', line 13 def validate!(schema_name, data) JSON::Validator.validate!(schema.send(schema_name), data) rescue Exception => e e. << "\nSchema: #{schema.class.name}::SCHEMA.#{schema_name}\nData: #{data.inspect}" raise e end |