Module: Casting::Enum

Extended by:
Enum
Included in:
Enum
Defined in:
lib/casting/enum.rb

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