Sha256: a0e253b776c1f654f62f89ae208636ae32836c22932fa4ec64557b8becf99582

Contents?: true

Size: 447 Bytes

Versions: 1

Compression:

Stored size: 447 Bytes

Contents

# frozen_string_literal: true

require 'dry/validation'
require 'dry/schema'

module DriedInteraction
  module ClassMethods
    attr_accessor :contract_validator

    def contract(kind = :simple, &block)
      case kind
      when :simple
        @contract_validator = Dry::Schema.Params(&block)
      when :extended
        @contract_validator = Dry::Validation.Contract(&block)
      else
        raise ArgumentError
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dried_interaction-0.1.1 lib/dried_interaction/class_methods.rb