09 Sep '12, 8am

Jay Fields’ Thoughts: Class Reopening Hints

Aman King left the following comment:I've always liked Ruby's open class feature but have also wondered how do you keep track of all the changes made to the class definition during runtime? ... There isn't an easy way (that I know of) out of the box to know what files made what changes to your objects. But, are a few things that you can do that may give you hints as to where behavior is coming from. Use modules instead of adding behavior directly. On my current project we needed to add a % method to symbol. You can accomplish this with the following code.class Symbol def %(arg) ... end end The above code does what you need, but leaves no hint that you've made a change to Symbol. An alternative solution is to define a module and include that module in Symbol.module SymbolExtension def %(arg) ... end end Symbol.send :include, SymbolExtension Granted, this isn't a huge hint, ...

Full article: http://blog.jayfields.com/2007/01/class-reopening-hints.html

Tweets

Class is in session

Class is in session

mrbrown.com 09 Sep '12, 12pm

This morning, I pointed out to the kids that the holidays were over and I could now get rid of them. I even sang a little ...

Hospital Corpsman 3rd Class James R. Layton- KI...

militarytimes.com 09 Sep '12, 1am

Navy Hospital Corpsman 3rd Class James R. Layton Died September 8, 2009 Serving During Operation Enduring Freedom 22, of R...

The Armstrong fallout: Thoughts and theories

sportsscientists.com 09 Sep '12, 9am

The Lance Armstrong fallout - questions, denials and doping reactions Friday last week saw Lance Armstrong release a state...

Corpsman 3rd Class Eichmann A. Strickland - KIA...

militarytimes.com 10 Sep '12, 1am

Navy Hospital Corpsman 3rd Class Eichmann A. Strickland Died September 9, 2008 Serving During Operation Enduring Freedom 2...

"Is class over yet?" #newpost

"Is class over yet?" #newpost

theseams.blogspot.com 21 Sep '12, 4am

What an amazing photo! The pink soles play so well against the neutrality of the rest of the outfit. This is such a cute p...

Sydney: A World Class City #NETWORKPRIVÉ

Sydney: A World Class City #NETWORKPRIVÉ

luxpresso.com 10 Sep '12, 12am

Sydney is Australia’s only truly global city which boasts a cosmopolitan vibe just bursting with character. The city featu...

Army Sgt. 1st Class Merideth L. Howard - KIA 09...

militarytimes.com 09 Sep '12, 1am

Army Sgt. 1st Class Merideth L. Howard Died September 8, 2006 Serving During Operation Enduring Freedom 52, of Alameda, Ca...

MOD sets out future of Invincible Class carriers

mod.uk 10 Sep '12, 2pm

"We would be keen to seek innovative proposals from a range of organisations, including private sector companies, charitie...

"World-class" van Persie can help Man Utd regain the Premier League title, says Giggs

"World-class" van Persie can help Man Utd regai...

straitstimes.com 09 Sep '12, 12pm

LONDON (AFP) - Ryan Giggs believes Robin van Persie's world-class goalscoring talent will prove the key to Manchester Unit...