Sha256: 3d89bc2c5125b1c8b3f69e8b21857b46d45a7cadfdae0838ab12553d241cdf0d

Contents?: true

Size: 581 Bytes

Versions: 2

Compression:

Stored size: 581 Bytes

Contents

module Cadet
  class Transaction
    attr_accessor :underlying

    def initialize(session)
      @session = session
      @underlying = @session.begin_tx
    end

    def method_missing(name, *args, &block)
      # for the "dsl".
      # the transaction block is instance_eval'd by this class,
      # so any missing methods are then sent to the session
      # essentially means that session.blah can then be writen blah
      @session.send(name, *args, &block)

    end

    def success
      @underlying.success
    end
    def close
      @underlying.close
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cadet-0.0.9-java lib/cadet/transaction.rb
cadet-0.0.8-java lib/cadet/transaction.rb