Code:
module Mod1
  def self.included(base)
    base.class_eval do
      class << self
        attr_accessor :test
      end
      @test = 'test1'
    end
  end
end
module Mod2
  def self.included(base)
    base.instance_eval do
      class << self
        attr_accessor :test
      end
      @test = 'test2'
    end
  end
end
class Foo1
  include Mod1
end
class Foo2
  include Mod2
end
puts Foo1.test
puts Foo2.test
Output is:
test1
test2
I realize one evaluates in the context of the class while the other evaluates in the context of the instance, but... in this case, why are they returning as such? (I'd have expected an exception in one or the other.)
 
     
    