Runtime assertions for Ruby literal.fun
ruby
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make the union type return an enumerator when each is called without a block

+9 -2
+9 -2
lib/literal/types/union_type.rb
··· 49 49 end 50 50 51 51 def each(&) 52 - @primitives.each(&) 53 - @types.each(&) 52 + if block_given? 53 + @primitives.each(&) 54 + @types.each(&) 55 + else 56 + Enumerator.new do |yielder| 57 + @primitives.each { |primitive| yielder.yield(primitive) } 58 + @types.each { |type| yielder.yield(type) } 59 + end 60 + end 54 61 end 55 62 56 63 def deconstruct