I
ivdkleyn
Hi there,
I've written an "Validation" module. Problem is that I would like to
add a class method to the class in which the module is included, and
not just an instance method.
For example: by including a module I would be able to call added
class-methods like in the following example
class Test
include Validation
validate_members :attr1, :attr2
rule_set :strict
end
Well, that doesn;t work (Ruby protests about instance methods which
cannot be found).
So therefore my question: how would I be able to add class methods to a
class through a Module?
Regards,
Iwan
I've written an "Validation" module. Problem is that I would like to
add a class method to the class in which the module is included, and
not just an instance method.
For example: by including a module I would be able to call added
class-methods like in the following example
class Test
include Validation
validate_members :attr1, :attr2
rule_set :strict
end
Well, that doesn;t work (Ruby protests about instance methods which
cannot be found).
So therefore my question: how would I be able to add class methods to a
class through a Module?
Regards,
Iwan