Class: ActiveGraph::Shared::TypeConverters::JSONConverter
- Inherits:
-
BaseConverter
- Object
- BaseConverter
- ActiveGraph::Shared::TypeConverters::JSONConverter
- Defined in:
- lib/active_graph/shared/type_converters.rb
Overview
Converts hash to/from JSON
Class Method Summary collapse
- .convert_type ⇒ Object
- .converted?(_value) ⇒ Boolean
- .db_type ⇒ Object
- .to_db(value) ⇒ Object
- .to_ruby(value) ⇒ Object
Methods inherited from BaseConverter
Class Method Details
.convert_type ⇒ Object
292 293 294 |
# File 'lib/active_graph/shared/type_converters.rb', line 292 def convert_type JSON end |
.converted?(_value) ⇒ Boolean
288 289 290 |
# File 'lib/active_graph/shared/type_converters.rb', line 288 def converted?(_value) false end |
.db_type ⇒ Object
296 297 298 |
# File 'lib/active_graph/shared/type_converters.rb', line 296 def db_type String end |
.to_db(value) ⇒ Object
300 301 302 |
# File 'lib/active_graph/shared/type_converters.rb', line 300 def to_db(value) value.to_json end |
.to_ruby(value) ⇒ Object
304 305 306 |
# File 'lib/active_graph/shared/type_converters.rb', line 304 def to_ruby(value) JSON.parse(value, quirks_mode: true) end |