Module: Casting::Enum
Instance Method Summary collapse
Instance Method Details
#enum(collection, *behaviors) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/casting/enum.rb', line 5 def enum(collection, *behaviors) Enumerator.new do |yielder| collection.each do |item| yielder.yield(item.cast_as(*behaviors)) end end end |