Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A presentation giving an introduction to Ruby's Enumerable mixin and Enumerator class
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
README.md
document.rb
resources.rb
slide10_sorting.rb
slide11_sorting_example.rb
slide12_enum_class.rb
slide13_why_enumerator.rb
slide14_why_enumerator_examples.rb
slide15_a_few_tricks.rb
slide1_intro.rb
slide2.rb
slide3_basic_class.rb
slide4_document.rb
slide5_document.rb
slide6_examples.rb
slide7_chainable.rb
slide8_inject.rb
slide9_inject2.rb

README.md

A look at Enumerable

Author: Chris McCord

Content

This presentation gives an introduction to Ruby's Enumerable mixin and Enumerator class. It is aimed for content that gives beginners a glimpse into Ruby's expressiveness, standard library, and style, as well as for seasoned Rubyists who may pick up a few insights and tricks into what Enumerable has to offer.

Slides

The slides contained within this presentation are plain ruby files that can be run or included for experimentation. The following examples can get you up running/playing on your own machines:

$ git clone git@github.com:chrismccord/ruby_enumerable_presentation.git
$ cd ruby_enumerable_presentation
$ ruby slide3_basic_class.rb
The first color of the Rainbow is 'red'
$ irb -r ./document.rb
1.9.3-p327 :001 > document = Document.new("This is some content")
=> #<Document:0x007fb27d1de638 @words=["This", "is", "some", "content"]> 
1.9.3-p327 :002 > document.include? "content"
 => true 

Outline

  • slide1_intro.rb: Introduction
  • slide2.rb: What is Enumerable?
  • slide3.rb: Basic class with Enumerable mixin example
  • slide4_document.rb: More complex Document class
  • slide5_document.rb: More complex Document class (cont)
  • slide6_examples.rb: Examples using enumerable methods
  • slide7_chainable.rb: Enumerators are chainable
  • slide8_inject.rb: Enumerable#inject
  • slide9_inject2.rb: Enumerable#inject (cont)
  • slide10_sorting.rb: Sorting with Enumerable using <=> operator
  • slide11_sorting_example.rb: Examples using Enumerable sorting methods
  • slide12_enum_class.rb: Using Ruby's Enumerator class
  • slide13_why_enumerator.rb: Use cases for Enumerator instances
  • slide14_why_enumerator_examples.rb: Enumerator examples
  • slide15_a_few_tricks.rb: A collection of interesting enumerable methods

Resources

Further resources for beginners

Contributing

Additions, corrections, examples, etc are all welcome for this slide set. Simply fork, make your commits, and submit a pull request.

Something went wrong with that request. Please try again.