Module: JsonRecord::Serialized::ClassMethods

Defined in:
lib/json_record/serialized.rb

Instance Method Summary collapse

Instance Method Details

#json_field_definition(name) ⇒ Object

Get the json field and the field definition of the JSON field from the schema it is defined in.



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/json_record/serialized.rb', line 35

def json_field_definition (name)
  if json_serialized_fields
    name = name.to_s
    json_serialized_fields.each_pair do |fname, schemas|
      schemas.each do |schema|
        field = schema.fields[name];
        return [fname, field] if field
      end
    end
  end
  return nil
end