Sha256: 1932661d20ee67fbc87448841be2bbbaf162594d44f1b2f0b876429575f41aa5

Contents?: true

Size: 519 Bytes

Versions: 1

Compression:

Stored size: 519 Bytes

Contents

# frozen_string_literal: true

module Redgraph
  class Edge
    attr_accessor :id, :src, :dest, :src_id, :dest_id, :type, :properties

    def initialize(src: nil, dest: nil, type: nil, properties: {})
      @src = src
      @src_id = @src.id if @src
      @dest = dest
      @dest_id = @dest.id if @dest
      @type = type
      @properties = properties
    end

    def persisted?
      !id.nil?
    end

    def ==(other)
      super || other.instance_of?(self.class) && !id.nil? && other.id == id
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redgraph-0.1.3 lib/redgraph/edge.rb