Skip to content

Instantly share code, notes, and snippets.

@pehrlich
Created January 25, 2012 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pehrlich/1674551 to your computer and use it in GitHub Desktop.
Save pehrlich/1674551 to your computer and use it in GitHub Desktop.
Serialize to property for neo4j
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