Sha256: 56901946dc7a6413fed9836aff8698a1a527a38adbef07e9322f7e845ea18562

Contents?: true

Size: 485 Bytes

Versions: 3

Compression:

Stored size: 485 Bytes

Contents

class Trailblazer::Operation
  module Contract
    module Persist
      def self.import!(operation, import, options={})
        save_method   = options[:method] || :save
        contract_name = options[:name] || "contract.default"

        import.(:&, ->(input, options) { options[contract_name].send(save_method) }, # TODO: test me.
          name: "persist.save")
      end
    end
  end

  DSL.macro!(:Persist, Contract::Persist, Contract.singleton_class) # Contract::Persist()
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trailblazer-2.0.0.rc1 lib/trailblazer/operation/persist.rb
trailblazer-2.0.0.beta3 lib/trailblazer/operation/persist.rb
trailblazer-2.0.0.beta2 lib/trailblazer/operation/persist.rb