Sha256: 7769a355c3a2df5aeaa58dc4ec8ac7cbe09357379e6a7aefe0b79bdb8fdf57c6

Contents?: true

Size: 607 Bytes

Versions: 19

Compression:

Stored size: 607 Bytes

Contents

module Neo4j
  module Core
    module TxMethods
      def tx_methods(*methods)
        methods.each do |method|
          tx_method = "#{method}_in_tx"
          send(:alias_method, tx_method, method)
          send(:define_method, method) do |*args, &block|
            session = args.last.is_a?(Neo4j::Session) ? args.pop : Neo4j::Session.current!

            Neo4j::Transaction.run(session.auto_commit?) { send(tx_method, *args, &block) }
          end
        end
      end
    end

    module Config
      def self.using_new_session?
        ENV.key?('NEW_NEO4J_SESSIONS')
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
neo4j-core-6.1.6 lib/neo4j-core/helpers.rb
neo4j-core-6.1.5 lib/neo4j-core/helpers.rb
neo4j-core-6.1.4 lib/neo4j-core/helpers.rb
neo4j-core-6.1.3 lib/neo4j-core/helpers.rb
neo4j-core-6.1.2 lib/neo4j-core/helpers.rb
neo4j-core-6.1.1 lib/neo4j-core/helpers.rb
neo4j-core-6.0.6 lib/neo4j-core/helpers.rb
neo4j-core-6.0.5 lib/neo4j-core/helpers.rb
neo4j-core-6.1.0 lib/neo4j-core/helpers.rb
neo4j-core-6.0.4 lib/neo4j-core/helpers.rb
neo4j-core-6.0.3 lib/neo4j-core/helpers.rb
neo4j-core-6.0.2 lib/neo4j-core/helpers.rb
neo4j-core-6.0.1 lib/neo4j-core/helpers.rb
neo4j-core-6.0.0 lib/neo4j-core/helpers.rb
neo4j-core-6.0.0.rc.1 lib/neo4j-core/helpers.rb
neo4j-core-6.0.0.alpha.6 lib/neo4j-core/helpers.rb
neo4j-core-6.0.0.alpha.5 lib/neo4j-core/helpers.rb
neo4j-core-6.0.0.alpha.2 lib/neo4j-core/helpers.rb
neo4j-core-6.0.0.alpha.1 lib/neo4j-core/helpers.rb