Skip to main content

Posts

Showing posts from May, 2014

Deals You Can't Miss

1 Year Subscription

When to freeze, clone or dup in Ruby?

I try out expressing my intent in different forms to see what works effective. This time around, I'd like to story tell the code as if it's evolving over a pair-programming session. I'd appreciate your constructive feedback. Warning the examples in story you're about to read might be super contrived and redundant. I'm merely trying the story-telling way to explain concepts with examples in the hope that you get near first-hand experience of pair-coding and experience learning. Chew on the concept leaving the contrived examples and story behind :P

Exploiting tap in Ruby

The instance method tap is available as part of Object class from Ruby 1.9.x onwards. Rubyists exploit it to different use cases for fun and fashion. This blog post is to share my thoughts on what I think tap is best for.

Require versus Load in Ruby

The big difference While you load a file , you require a feature Every time you load , you load a file into memory. On the other hand, every time you require you is if it has already been required to avoid repetition require is more abstract an API than  load . So typically for you're day to day use, you'd require not load . Because you load a file, the load method takes the input argument having file extension. The file extension is excluded in the case of require method.