Class: ActiveGraph::Shared::TypeConverters::YAMLConverter
Overview
Converts hash to/from YAML
Class Method Summary
collapse
converted?, #supports_array?
Class Method Details
.convert_type ⇒ Object
231
232
233
|
# File 'lib/active_graph/shared/type_converters.rb', line 231
def convert_type
Hash
end
|
.db_type ⇒ Object
235
236
237
|
# File 'lib/active_graph/shared/type_converters.rb', line 235
def db_type
String
end
|
.to_db(value) ⇒ Object
239
240
241
|
# File 'lib/active_graph/shared/type_converters.rb', line 239
def to_db(value)
Psych.dump(value)
end
|
.to_ruby(value) ⇒ Object
243
244
245
|
# File 'lib/active_graph/shared/type_converters.rb', line 243
def to_ruby(value)
value.is_a?(Hash) ? value : Psych.load(value)
end
|