Sha256: 72848ef37f6813758ef4360a28ab1e10dd68437dc989ff28b387b89f3751e168

Contents?: true

Size: 720 Bytes

Versions: 9

Compression:

Stored size: 720 Bytes

Contents

module Neo4j

  class Value
    include Neo4j::Property
    include org.neo4j.graphdb.Node

    def initialize(*args)
      # the first argument can be an hash of properties to set
      @props = {}
      if args[0].respond_to?(:each_pair)
        args[0].each_pair { |k, v| set_property(k.to_s, v) }
      end
    end

    # override Neo4j::Property#props
    def props
      @props
    end

    def getId
      nil
    end

    # Pretend this object is a Java Node
    def has_property?(key)
      !@props[key].nil?
    end

    def set_property(key,value)
      @props[key] = value
    end

    def get_property(key)
      @props[key]
    end

    def remove_property(key)
      @props.delete(key)
    end

  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
neo4j-1.0.0.beta.9 lib/neo4j/rails/value.rb
neo4j-1.0.0.beta.8 lib/neo4j/rails/value.rb
neo4j-1.0.0.beta.7 lib/neo4j/rails/value.rb
neo4j-1.0.0.beta.6 lib/neo4j/rails/value.rb
neo4j-1.0.0.beta.5 lib/neo4j/rails/value.rb
neo4j-1.0.0.beta.4 lib/neo4j/rails/value.rb
neo4j-1.0.0.beta.3 lib/neo4j/rails/value.rb
neo4j-1.0.0.beta.2 lib/neo4j/rails/value.rb
neo4j-1.0.0.beta.1 lib/neo4j/rails/value.rb