#rubyonrails - Tue 24 Apr 2007 between 01:47 and 01:54



pythonicit's a method for all instances of that class
pstickne_"held" in the object referenced by "A"
ReinHpstickne_: I mean that there really is no such thing as a "class method"
it's only an instance method on the object's metaclass
pstickne_ReinH, sure there is. it's a conventional name used when using a class/object oo system
ReinHpstickne_: sure, but they don't actually exist in ruby
they're called that for convenience
myobiei c now
ReinHand for all intents and purposes they do exist
but REALLY they don't
myobieso class methods are really instance methods on the meta class
makes sense, kinda
ReinHmyobie: right, which is class << self
pstickne_ReinH, anyway, I missed the difference between class << self; def x and def self.x (my mind is slow tonight)
myobieso self.method kinda obfusicates class << self some?
ReinHmyobie: the one difference I mentioned earlier has to do with inheritance
@@vars are class vars
myobieyes, so they would be confined improperly?
well, properly, but maybe unwanted
ReinHso what are vars like class << self; @var; end ?
objects can hold variables
myobieinstance vars of the metaclass?
pstickne_ReinH, but that's outside of a method...
pythonicboris yeltsin died
myobieReinH: was i right?
i mean, take your time
but i am pretty curious
versixanyone know how I can set up routing to allow for something like controller/action/id_1/id_2/id_3/id_n?
that is, a variable number of ids
ReinHmyobie: class variables are inherited and shared by subclasses, which might be surprising behavior
pstickne_class variables are icky. I still don't see how... anyway :)
myobieso the class inherits from the meta class?
pstickne_myobie, essentially
myobiehmmmm
ReinHmyobie: so, the old example is, say...
pstickne_I'd like to see class variables go away :)
ReinHclass Vehicle; @@wheels = 4; def wheels=(num); @@wheels = num; end; end
pstickne_: apparently their behavior will be changed in Ruby 2.0
car = Vehicle.new
myobieReinH: i write a bunch of stuff that looks like that, but with only one @

Page: 2 9 16 23 30 37 44 51 58 65 72 79 86 93 

IrcArchive