25 May '13, 11am

Ruby Quick Tip: Instant Utility Modules

Sometimes you want to write a batch of utility methods that can be accessed from a module for example Utility.parse_something(string) or any number of useful little tools for your application. Here’s a very clean-looking way to achieve it: module Utilities extend self def parse_something(string) # do stuff here end def other_utility_method(number, string) # do some more stuff end end By placing "extend self" at the top of the module, you are telling it to include all of the methods defined on your module as class methods on…your module. Which means that you can now access them like other class methods! While there are other ways to do this, I think this is a very semantically clean way that gets it done quite nicely. Update: And this is exactly why I post these Quick Tips, because sometimes there’s another solution that I hadn’t heard of! Using Ruby’s module_function you c...

Full article: http://www.intridea.com/blog/2010/4/19/ruby-quick-tip-ins...

Tweets

Gumstix Explains How To Cut Time-To-Market Using Modules via @ElectronicDesgn @gumstix

Gumstix Explains How To Cut Time-To-Market Usin...

electronicdesign.com 24 May '13, 11pm

Geppetto is a powerful platform for designing build-to-order embedded devices using modules. Geppetto extends the COM and ...

3 quick questions? #seo #seomoz

seomoz.org 25 May '13, 4pm

1) Are CSS Gallery's just the same as submitting to directories. yes they definitely can be if they're trading links or of...

Countdown to the "big announcement" at Ruby Kaigi

rubyflow.com 30 May '13, 11am

Countdown to the "big announcement" at Ruby Kaigi Posted by postmodern on May 30, 2013 — 0 comments The countdown on ruby-...

Understanding #Ruby Symbols

glu.ttono.us 25 May '13, 5pm

Posted by kev Fri, 19 Aug 2005 22:11:00 GMT Update 8/25: This post has been translated into korean . Update 12/12: I found...

Quick blog post : How to crimp a currypuff

Quick blog post : How to crimp a currypuff

rinaz.net 24 May '13, 7am

I’ve always had nice memories when making them. While still living in Singapore, I’d sit chit chatting with my mum as we c...

Take a look at the stunning 712U utility iron f...

bunkered.co.uk 27 May '13, 8am

General Manager of Titleist Golf Clubs, Steve Pelisek, discussed the development of the 712U. “We worked closely with our ...

Using Select2 with Ruby on Rails - Treehouse Qu...

blog.teamtreehouse.com 06 Jun '13, 5pm

In this Treehouse Quick-Tip, Jason Seifer shows you how to use the Select2 Plugin with Ruby on Rails. Select2 is a jQuery ...

Matt Kuchar leads by 1 @CrownePlazaInv QUICK RE...

pgatour.com 25 May '13, 10pm

By Mike McAllister, PGATOUR.COM FORT WORTH, Texas -- Matt Kuchar ended a long Saturday by maintaining his lead atop a crow...

@thomas_witt Something was messed up with the p...

robots.thoughtbot.com 30 May '13, 12pm

Two GETs. The second one is unnecessary. Two failure messages if something goes wrong. I only want to deal with the immedi...