Method: Neo4j::Transaction#session_and_run_in_tx_from_args
- Defined in:
- lib/neo4j/transaction.rb
#session_and_run_in_tx_from_args(args) ⇒ Object
To support old syntax of providing run_in_tx first But session first is ideal
147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/neo4j/transaction.rb', line 147 def session_and_run_in_tx_from_args(args) fail ArgumentError, 'Too few arguments' if args.empty? fail ArgumentError, 'Too many arguments' if args.size > 2 if args.size == 1 fail ArgumentError, 'Session must be specified' if !args[0].is_a?(Neo4j::Core::CypherSession) [args[0], true] else [true, false].include?(args[0]) ? args.reverse : args.dup end end |