25 Nov '13, 8pm

Anti-Pattern: Iteratively Building a Collection

Anti-Pattern: Iteratively Building a Collection Mike Burns November 25, 2013 ruby Ruby comes with many fantastic Enumerable methods, but the two most useful ones come through Smalltalk via LISP: #map and #inject . What follows are some lengthy method definitions followed by rewrites that are not only more concise but also more clear in their intentions. Building an array Requirement: As a user with a PGP key I want to see the list of key ids for all my signers so I can quickly import them from the keyserver. The initial implementation is a little lengthy and overly explicit: def signer_key_ids result = [] signers.each do |signer| result << signer.key_id end result end But a simple use of #map more clearly illuminates what this method does: def signer_key_ids signers.map { |signer| signer.key_id } end Building an array from multiple arrays Another requirement comes in: As a...

Full article: http://robots.thoughtbot.com/iteration-as-an-anti-pattern/

Tweets

Anti-Pattern: Iteratively Building a Collection

rubyflow.com 25 Nov '13, 9pm

Anti-Pattern: Iteratively Building a Collection Posted by croaky on November 25, 2013 — 0 comments Ruby comes with many fa...

Anti-Pattern: Iteratively Building a Collection:

robots.thoughtbot.com 26 Nov '13, 2am

Anti-Pattern: Iteratively Building a Collection Mike Burns November 25, 2013 ruby Ruby comes with many fantastic Enumerabl...

COLLECTION 271 NOW LAUNCHED!!! <3<3<3 HAPPY SHO...

// Please fill up the form below accurately. Submit only once. // An invoice will be sent to you shortly. // Please check ...

COLLECTION 272 NOW LAUNCHED!!! <3<3<3 HAPPY SHO...

// Please fill up the form below accurately. Submit only once. // An invoice will be sent to you shortly. // Please check ...

Check out the whole Nike Reflective collection ...

finishline.com 27 Nov '13, 6pm

FREE Shipping on thousands of styles. Promotional offer only valid on eligible items. Look for the "free shipping" text on...

Crabtree & Evelyn Holiday Collection 2013: This November, Crabtree & Evelyn launches their holiday collection

Crabtree & Evelyn Holiday Collection 2013: This...

felicianeo.com 26 Nov '13, 3am

Crabtree & Evelyn Holiday Collection 2013 This November, Crabtree & Evelyn launches their holiday collection – The Secret ...

COLLECTION 273 NOW LAUNCHED!!! <3<3<3 HAPPY SHO...

// Please fill up the form below accurately. Submit only once. // An invoice will be sent to you shortly. // Please check ...

#Photographs from the #Leica Collection :: Time Out #Singapore

#Photographs from the #Leica Collection :: Time...

timeoutsingapore.com 26 Nov '13, 2pm

23 original prints from the Leica collection showcases various works from famous photographers, from the renowned photo co...

#TheGamePlan features the Megatron Rises Collection! Details here:

#TheGamePlan features the Megatron Rises Collec...

kicksonfire.com 25 Nov '13, 5pm

I’m not one for hyperbole, but this latest edition of The Game Plan by Champs Sports is the best yet. As a matter of fact,...

COLLECTION 274 NOW LAUNCHED!!! <3<3<3 HAPPY SHO...

// Please fill up the form below accurately. Submit only once. // An invoice will be sent to you shortly. // Please check ...

Vans LXVI presents the new 'Red Dawn' Collection

Vans LXVI presents the new 'Red Dawn' Collection

solecollector.com 26 Nov '13, 1am

Patrick Swayze, C. Thomas Howell and Charlie Sheen's epic battle against communist invaders the California sunrise, the co...

How to Use Images in Your Link Building Campaigns

How to Use Images in Your Link Building Campaigns

searchenginewatch.com 26 Nov '13, 2pm

Use them to link back to your site from another site. We've had site owners say they don't do text links, but would happil...

In case you missed the amazing @USGBC @Greenbuild 2013, here is the recap of highlights!

In case you missed the amazing @USGBC @Greenbui...

usgbc.org 25 Nov '13, 4pm

This week, the U.S. Green Building Council (USGBC) welcomed nearly 25,000 green building professionals to Philadelphia for...

Meet Shayla! The perfect dashing, darting, cheering, touring, walking “Let’s go!” shoe #Dansko

Meet Shayla! The perfect dashing, darting, chee...

dansko.com 25 Nov '13, 6pm

about us Find a Retailer kids men women Home >> Womens Footwear >> Santa Fe VIEW OPTIONS View All Styles New This Season S...

Green building without the 'green premium'

Green building without the 'green premium'

usgbc.org 25 Nov '13, 10pm

When Saint Martin’s University set out to construct a new building to house its engineering program, one thing was clear: ...