Sha256: e8241906d7b9845cc4fc7feb0ab8836c2a5ab882ad8d65cc5c7380b69e0b9192
Contents?: true
Size: 565 Bytes
Versions: 13
Compression:
Stored size: 565 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
13 entries across 13 versions & 1 rubygems