Ruby Q? Which style:
def self.method
or
class << self
def method
#ruby #rubyonrails
@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 -
@davetron5000@pjb3@leshill@jremsikjr@merbist missing an instance method because it was grouped with self. singleton methods? Priceless -
@bascule@davetron5000@pjb3@leshill@jremsikjr missing? also, organizing class level and instance methods isn't a bad idea :p -
@merbist@davetron5000@pjb3@leshill@jremsikjr know what organizes code that way for you? class << self blocks - 1 more reply
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.