Doing exactly what you want is not possible. Instance variables are strictly for each object.
This happens as you expect, but is @textset to Windowsnot Software.
module Software
VAR = 'hejsan'
def exit
@text = "exited"
puts @text
end
end
class Windows
class <<self
include Software
def start
exit
puts VAR
puts @text
end
end
end
Windows.start
source
share