Sha256: 7437f605c67259d879879bc4a19507bd35c6222ef34a0549d01775c02989af21

Contents?: true

Size: 708 Bytes

Versions: 3

Compression:

Stored size: 708 Bytes

Contents

require "dry-configurable"
require "dry-transaction"
require "<%= config[:underscored_app_name] %>/container"

module <%= config[:camel_cased_app_name] %>
  class Transactions
    extend Dry::Configurable

    attr_reader :options

    setting :container, <%= config[:camel_cased_app_name] %>::Container
    setting :options, {}

    def self.define(&block)
      yield(new(options))
    end

    def self.options
      {container: config.container}.merge(config.options)
    end

    def initialize(options)
      @options = options
    end

    def container
      options[:container]
    end

    def define(name, &block)
      container.register(name, Dry.Transaction(options, &block))
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dry-web-roda-0.6.3 lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/transactions.rb.tt
dry-web-roda-0.6.2 lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/transactions.rb.tt
dry-web-roda-0.6.1 lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/transactions.rb.tt