When is a class variable a class variable? When it's not an instance variable I guess:
irb>>
>> class Foo
>> attr_reader :foo
?> @foo = "I exist in the class object" #class instance variable
>> @@foo = "I have no idea where I exist" #class variable
>>
?> def initialize(*args)
>> @foo = "I am an instance variable" #instance variable
>> end
>>
?> def self.read_foo
>> puts Foo.new.foo
>> puts @foo
>> puts @@foo
>> end
>> end
=> nil
>>
?> Foo.read_foo
I am an instance variable
I exist in the class object
I have no idea where I exist
=> nil
>>
I am a technologist who became test infected in 2004 and I have been trying to spread it ever since. Every once and a while I turn green, become enormous, and start smashing things. [Disclaimer: The opinions expressed herein are those of the author and not of his employer.] Don't blame them for the stuff you read here.
Saturday, December 27, 2008
Thursday, December 18, 2008
Installing RCov on Mac OS X.5
I tried installing rcov on my Mac OS 10.5.6
$>sudo gem install rcov
Password:
Building native extensions. This could take a while...
ERROR: Error installing rcov:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install rcov
can't find header files for ruby.
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/rcov-0.8.1.2.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/rcov-0.8.1.2.0/ext/rcovrt/gem_make.out
Really? That sucks. I asked the interweb and I found this post:
http://www.macruby.org/trac/wiki/Troubleshooting
OK so I installed Xcode 3 from here: http://developer.apple.com/Tools/xcode/ and then installed mac ports from here: http://www.macports.org/
Everything worked after that! Awesome!
$>sudo gem install rcov
Password:
Building native extensions. This could take a while...
ERROR: Error installing rcov:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install rcov
can't find header files for ruby.
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/rcov-0.8.1.2.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/rcov-0.8.1.2.0/ext/rcovrt/gem_make.out
Really? That sucks. I asked the interweb and I found this post:
http://www.macruby.org/trac/wiki/Troubleshooting
OK so I installed Xcode 3 from here: http://developer.apple.com/Tools/xcode/ and then installed mac ports from here: http://www.macports.org/
Everything worked after that! Awesome!
Friday, December 12, 2008
Corey Haines insights - Tools Vs. Technique
Corey provides some awesome insights while on the road pair programming with great developers:
http://programmingtour.blogspot.com/2008/12/road-thoughts-tools-v-technique.html
http://programmingtour.blogspot.com/2008/12/road-thoughts-tools-v-technique.html
Sunday, December 7, 2008
Subscribe to:
Posts (Atom)