lib/pragma/contract/coercion.rb in pragma-contract-2.0.0 vs lib/pragma/contract/coercion.rb in pragma-contract-2.0.1
- old
+ new
@@ -6,32 +6,25 @@
def self.included(klass)
klass.extend ClassMethods
end
module ClassMethods
- def property(*args, &block)
- if block_given?
- super(*args) do
- include Pragma::Contract::Coercion
- instance_eval(&block)
- end
- else
- super(*args)
- end
- end
-
- private
-
def strict(type)
build_type 'Strict', type
end
def coercible(type)
build_type 'Coercible', type
end
def form(type)
- build_type 'Form', type
+ # Dry::Types 0.13 renames Types::Form to Types::Params and the Int type to Integer.
+
+ if Dry::Types['form.int']
+ build_type 'Form', type
+ else
+ build_type 'Params', type.to_sym == :int ? :integer : type
+ end
end
def json(type)
build_type 'Json', type
end