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
- #===(value) ⇒ boolean
- #call(input) ⇒ Object
- #try(input) {|failure| ... } ⇒ Dry::Types::Result
-
#|(type) ⇒ Dry::Types::Sum
Build a new sum type.
Instance Method Details
#===(value) ⇒ boolean
39 |
# File 'lib/dry/struct/sum.rb', line 39 def ===(value) = left === value || right === value |
#call(input) ⇒ Object
9 10 11 12 13 |
# File 'lib/dry/struct/sum.rb', line 9 def call(input) left.try_struct(input) do right.try_struct(input) { super } end end |