Class: ActiveGraph::Shared::TypeConverters::YAMLConverter
Overview
Converts hash to/from YAML
Class Method Summary
collapse
converted?, #supports_array?
Class Method Details
.convert_type ⇒ Object
267
268
269
|
# File 'lib/active_graph/shared/type_converters.rb', line 267
def convert_type
Hash
end
|
.db_type ⇒ Object
271
272
273
|
# File 'lib/active_graph/shared/type_converters.rb', line 271
def db_type
String
end
|
.to_db(value) ⇒ Object
275
276
277
|
# File 'lib/active_graph/shared/type_converters.rb', line 275
def to_db(value)
Psych.dump(value)
end
|
.to_ruby(value) ⇒ Object
279
280
281
|
# File 'lib/active_graph/shared/type_converters.rb', line 279
def to_ruby(value)
value.is_a?(Hash) ? value : Psych.load(value)
end
|