I must be really thick with this because I cannot get my class to
What I want to do is
and have that module mixin both instance and class methods. I’ve seen
done, but obviously I don’t understand what’s really going on because I
can’t make it happen. I know this has been discussed on the list before
well. I’ve reviewed that as well. I fell really thick with this one.
just not going in.
Here’s what I’ve tried (don’t worry it’s short). I put this into a
file and just run it. Any pointers to the source of my misunderstanding
would be great.
base.send( :include, InstanceMethods )
puts “I’m an instance method”
puts “I’m a class method”
class MyModuleTest < Test::Unit::TestCase
assert Object.respond_to?( :a )
def test_object_should_not_have_the_a_method_as_instance_method assert !Object.new.respond_to?( :a ) end def test_object_should_have_the_b_method_as_instance_method assert Object.new.respond_to?( :b ) end def test_object_should_not_have_the_b_method_as_class_method assert !Object.respond_to?( :b ) end