Sha256: f9c106f254f2f2c6b94c87b190c204ada5bf818fe249f41b4dc15dba13e560b7
Contents?: true
Size: 566 Bytes
Versions: 17
Compression:
Stored size: 566 Bytes
Contents
module Neo4j::Core module ArgumentHelper def self.session(args) args.last.kind_of?(Neo4j::Session) ? args.pop : Neo4j::Session.current! end end 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 = ArgumentHelper.session(args) Neo4j::Transaction.run(session.auto_commit?) { send(tx_method, *args, &block) } end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems