Class: Dry::Struct::Sum
- Inherits:
-
Types::Sum::Constrained
- Object
- Types::Sum::Constrained
- Dry::Struct::Sum
- Defined in:
- lib/dry/struct/sum.rb
Overview
A sum type of two or more structs As opposed to Dry::Types::Sum::Constrained this type tries no to coerce data first.
Instance Method Summary collapse
- #try(input) {|failure| ... } ⇒ Dry::Types::Result
-
#|(type) ⇒ Dry::Types::Sum
Build a new sum type.
Instance Method Details
#try(input) {|failure| ... } ⇒ Dry::Types::Result
13 14 15 16 17 18 19 |
# File 'lib/dry/struct/sum.rb', line 13 def try(input) if input.is_a?(Struct) try_struct(input) { super } else super end end |