Class: ActiveGraph::Shared::TypeConverters::YAMLConverter
Overview
Converts hash to/from YAML
Class Method Summary
collapse
converted?, #supports_array?
Class Method Details
.convert_type ⇒ Object
225
226
227
|
# File 'lib/active_graph/shared/type_converters.rb', line 225
def convert_type
Hash
end
|
.db_type ⇒ Object
229
230
231
|
# File 'lib/active_graph/shared/type_converters.rb', line 229
def db_type
String
end
|
.to_db(value) ⇒ Object
233
234
235
|
# File 'lib/active_graph/shared/type_converters.rb', line 233
def to_db(value)
Psych.dump(value)
end
|
.to_ruby(value) ⇒ Object
237
238
239
|
# File 'lib/active_graph/shared/type_converters.rb', line 237
def to_ruby(value)
value.is_a?(Hash) ? value : Psych.load(value)
end
|