lib/dry/struct/sum.rb in dry-struct-1.4.0 vs lib/dry/struct/sum.rb in dry-struct-1.5.0

- old
+ new

@@ -1,10 +1,7 @@ # frozen_string_literal: true -require "dry/types/sum" -require "dry/types/printer" - module Dry class Struct # A sum type of two or more structs # As opposed to Dry::Types::Sum::Constrained # this type tries no to coerce data first. @@ -44,12 +41,12 @@ end protected # @private - def try_struct(input) + def try_struct(input, &block) left.try_struct(input) do - right.try_struct(input) { yield } + right.try_struct(input, &block) end end end end end