Sha256: f93f46531c8f9b01cbee868a1578410c8a8b69d206a7cbc8681cd545a8e54961
Contents?: true
Size: 814 Bytes
Versions: 20
Compression:
Stored size: 814 Bytes
Contents
require 'dry/equalizer' module ROM # TODO: finish this in 1.1.0 # # @api private class Session include Dry::Equalizer(:queue, :status) attr_reader :repo attr_reader :queue attr_reader :status def initialize(repo) @repo = repo @status = :pending initialize_queue! end def add(changeset) queue << changeset self end def commit! queue.each(&:commit) @status = :success self rescue => e @status = :failure raise e ensure initialize_queue! end def pending? status.equal?(:pending) end def success? status.equal?(:success) end def failure? status.equal?(:failure) end private def initialize_queue! @queue = [] end end end
Version data entries
20 entries across 20 versions & 1 rubygems