class TableSchema::Types::Object
Public Class Methods
supported_constraints()
click to toggle source
# File lib/tableschema/types/object.rb, line 9 def self.supported_constraints [ 'required', 'unique', 'pattern', 'enum', 'minLength', 'maxLength', ] end
Public Instance Methods
cast_default(value)
click to toggle source
# File lib/tableschema/types/object.rb, line 24 def cast_default(value) return value if value.is_a?(type) parsed = JSON.parse(value, symbolize_names: true) if parsed.is_a?(Hash) return parsed else raise TableSchema::InvalidObjectType.new("#{value} is not a valid object") end rescue raise TableSchema::InvalidObjectType.new("#{value} is not a valid object") end
name()
click to toggle source
# File lib/tableschema/types/object.rb, line 5 def name 'object' end
type()
click to toggle source
# File lib/tableschema/types/object.rb, line 20 def type ::Hash end