Ruby enumerable every

Enumerable Every Pretty cool idea, it replaces the notion of Symbol#to_proc with a slightly cleaner, simpler syntax.

  enum = [1.4, 2.4 ,3.4]
  enum.map {|n| n.floor } #=> [1, 2, 3]
  enum.map(&:floor)       #=> [1, 2, 3]
  enum.every.floor        #=> [1, 2, 3]

neat! Who says you can’t make things simpler.

Check it out on github.

Short URL for this post: http://tumblr.com/Zi0jYy5fyha
blog comments powered by Disqus