RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  
 

nithinbekal — 13 posts

http://nithinbekal.com

Flip Flop Operator in Ruby  nithinbekal.com
The flip flop operator is one of those weird features of Ruby that most people aren’t even aware of. It’s one of the many Perlisms that sneaked into Ruby, but hasn’t caught on. In this post, we will look at what flip-flop operators are, and where you can use them.
Tail call optimization is an optimization where tail recursive functions are transformed into loops by the compiler. A tail recursive function is one where the final statement is a call to the same method. In this post, we will look at what tail recursive functions look like, how tail call optimization helps them, and how to enable TCO in Ruby. [Continue reading]
Memoization is an optimization technique where you cache the results of expensive method calls. When the method is called with the same set of arguments, the cached result is returned. In this post, we will look at how we can implement memoization using Ruby's metaprogramming features. [Continue reading...]
The protected method visibility in Ruby is one of its more confusing aspects. I recently took a closer look at it, and found that it has an interesting use case. [Continue reading...]
Decorator Pattern in Ruby  nithinbekal.com
Decorators allow us to add behavior to objects without affecting other objects of the same class. The decorator pattern is a useful alternative to creating sub-classes. We will look at an example where we use subclassing to solve a problem, and then look at how decorator objects provide a better solution. [Continue reading...]
Presenters in Rails  nithinbekal.com
When your models are bloated with methods that are only used in views, it might be a good time to refactor them. Moving that logic into helper modules might be OK in some cases, but as the complexity of your views grows, you might want to look at presenters. In this article, I will walk through how I refactored views to use presenters instead of helper methods. [Continue reading...]
The Law of Demeter  nithinbekal.com
I wrote a blog post explaining the Law of Demeter with a simple example in Ruby.
I wrote up the 5th part of the series of blog posts about writing Ruby gems. This one is about setting up Rspec to test your gem. If you missed the previous posts, you can find all the posts linked here.
Guide to writing Ruby gems  nithinbekal.com
I wrote a bunch of posts for beginners about how to get started writing a new Ruby gem. I'll be adding more posts soon, but for now I've finished four short posts.

You can see all the links in one place here or go to the individual pages here:

Part 1 - Gem specifications
Part 2 - Adding some code
Part 3 - Publishing to rubygems.org
Part 4 - Setting up Test::Unit
Here's my review of The Rails 3 Way by Obie Fernandez.
I finished reading Russ Olsen's new book Eloquent Ruby a few days ago. Here's my review of the book.
Using Haml with Rails  nithinbekal.com
A short introduction to getting started with using Haml instead of Erb with Rails.
I just created the gem spellingbee which is a spelling correction tool. It's my first gem, so it has way too many bugs to fix, but I'd appreciate feedback on how to improve it. Please do fork it on github and improve it or report a bug here.