Skip to content

Latest commit

 

History

History
114 lines (43 loc) · 1.1 KB

JSONConverter.rst

File metadata and controls

114 lines (43 loc) · 1.1 KB

JSONConverter

Converts hash to/from JSON

Constants

Files

Methods

.convert_type

def convert_type
  JSON
end

.converted?

def converted?(value)
  value.is_a?(db_type)
end

.db_type

def db_type
  String
end

.to_db

def to_db(value)
  value.to_json
end

.to_ruby

def to_ruby(value)
  JSON.parse(value, quirks_mode: true)
end