This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# inject is cool and elegant. I use it when I want to be cool. However, I tend to robotically begin the procedural | |
# way and end up at inject when I realize I am in that situation. See this simple example: | |
include ActionView::Helpers | |
class Link < Struct.new(:title, :url); end | |
a = Link.new("Google", "http://www.google.com") | |
b = Link.new("Hacker News", "http://news.ycombinator.com") | |
array_of_links = [a, b] |