Module: Neo4j::Core::TxMethods

Included in:
Embedded::EmbeddedLabel, Embedded::EmbeddedSession, Embedded::NodesIterator, Embedded::Property, Embedded::RelsIterator
Defined in:
lib/neo4j-core/helpers.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) tx_methods(*methods)



10
11
12
13
14
15
16
17
18
19
# File 'lib/neo4j-core/helpers.rb', line 10

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 = ArgumentHelper.session(args)
      Neo4j::Transaction.run(session.auto_commit?) { send(tx_method, *args, &block) }
    end
  end
end