Skip to content

Phrappe

ice-chilled, instant web tips

  • articles
  • javascript
  • ruby
  • coffeescript
  • markup
  • css
  • projects
  • wordpress
  • mobile
  • ux
  • misc

Pages

  • About
  • Ambrosia theme
  • Contact

Follow me

My Tweets

Tag: enumerable

Ruby Hash iteration with index

Ruby Hash (and Array) includes the Enumerable module (mixin), which provides a lot of neat, but also slightly hidden in the documentation, methods. This means that despite the poor advertising you can iterate not only each key and value, but the index as well:

Posted on December 12, 2015Categories rubyTags enumerable, hash, index, iteration, mixin, module, rubyLeave a comment on Ruby Hash iteration with index
Proudly powered by WordPress