class Mongomery::Schema
Constants
- VALID_TYPES
Public Class Methods
new(schema)
click to toggle source
# File lib/mongomery/schema.rb, line 5 def initialize(schema) @schema = schema end
Public Instance Methods
column_type(col)
click to toggle source
# File lib/mongomery/schema.rb, line 13 def column_type(col) value = type_value(col) if VALID_TYPES.include?(value) value else nil end end
property(col)
click to toggle source
# File lib/mongomery/schema.rb, line 9 def property(col) @schema.properties[col] end
type_value(col)
click to toggle source
# File lib/mongomery/schema.rb, line 22 def type_value(col) type = property(col).try(:type) case type when Array (type - ["null"]).first else type end end