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
250 251 252 |
# File 'lib/active_graph/shared/type_converters.rb', line 250 def convert_type JSON end |
.converted?(_value) ⇒ Boolean
246 247 248 |
# File 'lib/active_graph/shared/type_converters.rb', line 246 def converted?(_value) false end |
.db_type ⇒ Object
254 255 256 |
# File 'lib/active_graph/shared/type_converters.rb', line 254 def db_type String end |
.to_db(value) ⇒ Object
258 259 260 |
# File 'lib/active_graph/shared/type_converters.rb', line 258 def to_db(value) value.to_json end |
.to_ruby(value) ⇒ Object
262 263 264 |
# File 'lib/active_graph/shared/type_converters.rb', line 262 def to_ruby(value) JSON.parse(value, quirks_mode: true) end |