Tag Archive for 'wtf'

Rails power. Use with caution.

I’ve found a few lines of code that make use of Rails’ method returning. I’ve seen it on the Errtheblog before and thought that it can be useful but someone will misuse it for sure. So here it is.

def feeds_list returning([]) do |feeds| BLOGS.each do |blog| feeds < < feed_url_for(@app_name, blog) end end end

Why do people do such things if there’s Array#collect

def feeds_list BLOGS.collect do |blog| feed_url_for(@app_name, blog) end end