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
256 257 258 |
# File 'lib/active_graph/shared/type_converters.rb', line 256 def convert_type JSON end |
.converted?(_value) ⇒ Boolean
252 253 254 |
# File 'lib/active_graph/shared/type_converters.rb', line 252 def converted?(_value) false end |
.db_type ⇒ Object
260 261 262 |
# File 'lib/active_graph/shared/type_converters.rb', line 260 def db_type String end |
.to_db(value) ⇒ Object
264 265 266 |
# File 'lib/active_graph/shared/type_converters.rb', line 264 def to_db(value) value.to_json end |
.to_ruby(value) ⇒ Object
268 269 270 |
# File 'lib/active_graph/shared/type_converters.rb', line 268 def to_ruby(value) JSON.parse(value, quirks_mode: true) end |