Class: Dry::Types::Sum::Constrained
- Inherits:
-
Dry::Types::Sum
- Object
- Dry::Types::Sum
- Dry::Types::Sum::Constrained
- Defined in:
- lib/dry/types/sum.rb
Instance Attribute Summary
Attributes inherited from Dry::Types::Sum
Attributes included from Options
Instance Method Summary collapse
Methods inherited from Dry::Types::Sum
#default?, #initialize, #maybe?, #name, #primitive?, #try, #valid?
Methods included from Options
Methods included from Builder
#constrained, #constrained_type, #constructor, #default, #enum, #maybe, #optional, #safe, #|
Constructor Details
This class inherits a constructor from Dry::Types::Sum
Instance Method Details
#call(input) ⇒ Object Also known as: []
30 31 32 33 34 |
# File 'lib/dry/types/sum.rb', line 30 def call(input) try(input) do |result| raise ConstraintError.new(result, input) end.input end |
#constrained? ⇒ true
23 24 25 |
# File 'lib/dry/types/sum.rb', line 23 def constrained? true end |
#rule ⇒ Dry::Logic::Rule
18 19 20 |
# File 'lib/dry/types/sum.rb', line 18 def rule left.rule | right.rule end |