Hello,
After an hour of farting around trying to figure this out, of course I do figure it out 20 seconds after writing to the list. Well, here's one solution to my issue - I'd still love to see a one-line solution if anyone can come up with one (but it's not necessary for me at all, just curiosity and desire to learn cool Rubyisms):
[code starts]
module Models
module Ver
def is_versioned
include Models::VersionsTables::InstanceMethods
self.extend Models::VersionsTables::ClassMethods
end
end
module VersionsTables
module InstanceMethods
def instance_test
"instance test"
end
end
module ClassMethods
def class_test
"class_test"
end
end
end
end
class Live
extend Models::Ver
is_versioned
end
puts "::"+Live.class_test
live = Live.new
puts live.instance_test
[code ends]
So it uses two lines of code, but I can live with that because only the second line of code actually causes the class AND instance methods to be included - so they're all or nothing - you either get class and instance or nothing (the reason I care is that some monkey-see, monkey-do coder down the road could pull something into their class out of context and I want these functions to either work or fail, not yield partial and erroneous capability).
Sorry for being the noise in your signal,
Steve
···
-
The law is an envious monster.
- Rex Stout