class Foo def self.value @value ||= defined?(super) ? super : DEFAULT_VALUE endend
this will turn Foo.value into a value you can configure per class (with a default), and you'll automatically inherit the superclass' value
@judofyr or use `@@value`?
@zenspider that’s shared across all (sub/super)classes, no? this can be different per class
@judofyr only from where it is assigned and down. Not up or over.
A Mastodon instance for Rubyists & friends