Sha256: 5cfb18050a284aa3caee859ad2caf90da576b49f3d6dbe52a87097a803d08868

Contents?: true

Size: 797 Bytes

Versions: 40

Compression:

Stored size: 797 Bytes

Contents

require 'neo4j/core/wrappable'
require 'active_support/core_ext/hash/keys'

module Neo4j
  module Core
    class Node
      attr_reader :id, :labels, :properties
      alias props properties

      include Wrappable

      # Perhaps we should deprecate this?
      alias neo_id id

      def initialize(id, labels, properties = {})
        @id = id
        @labels = labels.map(&:to_sym) unless labels.nil?
        @properties = properties.symbolize_keys
      end

      def ==(other)
        other.is_a?(Node) && neo_id == other.neo_id
      end

      class << self
        def from_url(url, properties = {})
          id = url.split('/')[-1].to_i
          labels = nil # unknown
          properties = properties

          new(id, labels, properties)
        end
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
neo4j-core-9.0.0 lib/neo4j/core/node.rb
neo4j-core-9.0.0.alpha.1 lib/neo4j/core/node.rb
neo4j-core-8.1.4 lib/neo4j/core/node.rb
neo4j-core-8.1.3 lib/neo4j/core/node.rb
neo4j-core-8.1.2 lib/neo4j/core/node.rb
neo4j-core-8.1.1 lib/neo4j/core/node.rb
neo4j-core-8.1.0 lib/neo4j/core/node.rb
neo4j-core-8.0.4 lib/neo4j/core/node.rb
neo4j-core-8.0.3 lib/neo4j/core/node.rb
neo4j-core-8.0.2 lib/neo4j/core/node.rb
neo4j-core-8.0.1 lib/neo4j/core/node.rb
neo4j-core-7.2.4 lib/neo4j/core/node.rb
neo4j-core-8.0.0 lib/neo4j/core/node.rb
neo4j-core-7.2.3 lib/neo4j/core/node.rb
neo4j-core-7.2.2 lib/neo4j/core/node.rb
neo4j-core-7.2.1 lib/neo4j/core/node.rb
neo4j-core-7.2.0 lib/neo4j/core/node.rb
neo4j-core-7.1.2 lib/neo4j/core/node.rb
neo4j-core-7.0.9 lib/neo4j/core/node.rb
neo4j-core-7.1.1 lib/neo4j/core/node.rb