Sha256: 2786f6b5858c5b5103d4709234e5cbad4e7f1a686d28a5a3112ac308126d0468

Contents?: true

Size: 877 Bytes

Versions: 42

Compression:

Stored size: 877 Bytes

Contents

module ActiveGraph::Shared
  module Cypher
    module CreateMethod
      def create_method
        creates_unique? ? :create_unique : :create
      end

      def creates_unique(option = :none)
        option = :none if option == true
        @creates_unique = option
      end

      def creates_unique_option
        @creates_unique || :none
      end

      def creates_unique?
        !!@creates_unique
      end
      alias unique? creates_unique?
    end

    module RelIdentifiers
      extend ActiveSupport::Concern

      [:from_node, :to_node, :rel].each do |element|
        define_method("#{element}_identifier") do
          instance_variable_get(:"@#{element}_identifier") || element
        end

        define_method("#{element}_identifier=") do |id|
          instance_variable_set(:"@#{element}_identifier", id.to_sym)
        end
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
activegraph-10.0.0.pre.beta.2 lib/active_graph/shared/cypher.rb
activegraph-10.0.0.pre.beta.1 lib/active_graph/shared/cypher.rb