Ruby Q? Which style:
def self.method
or
class << self
def method
#ruby #rubyonrails
-
-
Replying to @leshill
@leshill@jremsikjr the former for one-offs, the latter for large numbers of methods or if you need e.g attr_accessor, alias_method3 replies 0 retweets 1 like -
Replying to @bascule
@bascule@leshill@jremsikjr +1, but if you need enough methods for class << self, use a extend ClassMethods1 reply 0 retweets 0 likes -
Replying to @judsonlester
@judsonlester@leshill@jremsikjr how about… bolth? https://github.com/celluloid/celluloid/blob/master/lib/celluloid.rb …2 replies 0 retweets 0 likes -
Replying to @bascule
@bascule@leshill@jremsikjr Or even all three: digging "extend self" there. :) Why decide?1 reply 0 retweets 0 likes
Replying to @judsonlester
@judsonlester @leshill @jremsikjr yeah, the instance methods in the module are just shortcuts to the singleton methods in that case
3:41 PM - 15 Aug 2012
0 replies
0 retweets
0 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.