public
Created

Serialize to property for neo4j

  • Download Gist
SerializeConverter.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.