I found class << self, but still here's an even simpler example that
doesn't work as I thought it would:
module Color
def set_fill(color)
puts "testing"
@@fill_color = color
end
end
class Shape
@@fill_color = 'black'
class << self
include Color
end
def self.fill_color
@@fill_color
end
end
Shape.new
puts Shape.fill_color
Shape.set_fill('red')
puts Shape.fill_color
I get:
black
testing
black
--gw
--
Posted via http://www.ruby-forum.com/.