Created
January 25, 2012 03:30
-
-
Save pehrlich/1674551 to your computer and use it in GitHub Desktop.
Serialize to property for neo4j
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Neo4j | |
module TypeConverters | |
class SerializeConverter | |
# serializes to sting | |
class << self | |
def convert?(type) | |
type == :serialize | |
end | |
def to_java(value) | |
return nil unless value | |
JSON.generate(value).to_s | |
end | |
def to_ruby(value) | |
return nil unless value | |
JSON.parse(value.to_s) | |
end | |
end | |
end | |
end | |
end | |
Neo4j::TypeConverters.converters = nil # reload converters |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment