G
Greg Willits
I would like to populate a class variable using a method
class SomeThing
@@some_data
populate_some_data
def populate_some_data
end
end
I expected that prefixing the method with self would work. It doesn't.
...
self.populate_some_data
def self.populate_some_data
end
...
Poking around in a couple books I don't see anything that addresses
this. What's the correct syntax for this? Or, if there is no way to run
a method, what's the best way to pull a trigger to have @@some_data
populated the first time any object of SomeThings is instantiated?
-- gw
class SomeThing
@@some_data
populate_some_data
def populate_some_data
end
end
I expected that prefixing the method with self would work. It doesn't.
...
self.populate_some_data
def self.populate_some_data
end
...
Poking around in a couple books I don't see anything that addresses
this. What's the correct syntax for this? Or, if there is no way to run
a method, what's the best way to pull a trigger to have @@some_data
populated the first time any object of SomeThings is instantiated?
-- gw