ruby cold cuts_2
DESCRIPTION
TRANSCRIPT
Ruby Cold CutsPart II
Enumerating Enumerable
INTO DARKNESS
Review
• Idiomatic Ruby for Iterating / Looping
• Part of the Ruby Core
• Written in C (very fast)
• Includes many methods to help in development
• Is a module
Enumerable
Modules• Composition
• Built into the Ancestor Tree
• Methods defined in module are available to classes
More Enumerable
#inject
#inject
#inject
#inject
#inject
#grep
#take_while
HashArray
Set
Implementing Enumerable
• Include Enumerable
• Define Each
• Yield or Delegate
• Optionally Define <=>
Internal Iterator
Self Iterator
Demo
Thank You