G
George Moschovitis
Hello everyone,
the following idiom is very useful:
module MyModule
def self.append_features(base)
super; base.extend(ClassMethods)
end
module ClassMethods
def a_class_method
puts 'class'
end
end
end
class MyClass
include MyModule
end
MyClass.a_class_method # => 'class'
I think it would be a good idea to have some form of syntactic sugar
for this idiom in Ruby 1.9/2.0
Any ideas ?
-g.
the following idiom is very useful:
module MyModule
def self.append_features(base)
super; base.extend(ClassMethods)
end
module ClassMethods
def a_class_method
puts 'class'
end
end
end
class MyClass
include MyModule
end
MyClass.a_class_method # => 'class'
I think it would be a good idea to have some form of syntactic sugar
for this idiom in Ruby 1.9/2.0
Any ideas ?
-g.