module Mod
var = 2
end
class Person
include Mod
puts var
end
Simple question. Why can't i access a local variable imported from a module?
When you are including a module inside another module or class, Ruby’s default implementation is to add the constants, methods, and module variables of this module to mod(where you are including the module) if this module has not already been added to mod or one of its ancestors.
In your case var is a local variable of module Mod, so it can't be included inside the class Person, by the line include Mod.