Skip to content

Instantly share code, notes, and snippets.

@joevandyk
Created April 11, 2016 00:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joevandyk/07ce4aaaed07544c3dc3dd9c2d8829ab to your computer and use it in GitHub Desktop.
Save joevandyk/07ce4aaaed07544c3dc3dd9c2d8829ab to your computer and use it in GitHub Desktop.
module Types
include Dry::Types.module
Percentage = Strict::Decimal.constrained(gt: 0, lt: 1)
Quantity = Strict::Int.constrained(gt: 0)
end
class Tier < Dry::Types::Struct
attribute(:quantity, Types::Quantity)
attribute(:percentage, Types::Percentage)
end
form_schema = Dry::Validation.Form do
key(:quantity).required(Types::Quantity)
key(:percentage).required(Types::Percentage)
end
gems/dry-types-0.7.1/lib/dry/types/compiler.rb:15:in `visit': undefined method `visit_[:type, "string"]' for #<Dry::Types::Compiler:0x007f7d16496f98 @registry=Dry::Types> (NoMethodError)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment