Ruby Q? Which style:
def self.method
or
class << self
def method
#ruby #rubyonrails
@pjb3 @leshill @jremsikjr lol one of the great Ruby holy wars, like Seattle-style parens on defs
-
-
@bascule@pjb3@leshill@jremsikjr I only use "class << self" when no other options are available, clarity level: -10 -
@bascule@pjb3@leshill@jremsikjr Agree with@merbist. -
@davetron5000@pjb3@leshill@jremsikjr@merbist c'mon, class << self is so simple even a baby can understand: http://mislav.uniqpath.com/poignant-guide/images/about.the.poignant.guide-2.jpg … -
@bascule@pjb3@leshill@jremsikjr@merbist it requires too much context to understand code inside it vs. typing 5 characters per method -
@davetron5000@pjb3@leshill@jremsikjr@merbist personally I like the logical grouping it provides and being able to collapse them together -
@bascule@davetron5000@leshill@jremsikjr@merbist once the class << self … end block stretches to longer than a screen, it get's ugly -
@pjb3@davetron5000@leshill@jremsikjr@merbist know what's ugly? a mixed bag of singleton and instance methods ;) -
@bascule@pjb3@leshill@jremsikjr@merbist understanding def self.blah requires 1 line to be read, understaningd def blah requires ∞ lines - 4 more replies
New conversation -
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.