module Greeting
def hello name
@name = name
"Hello #{name}"
end
def name
@name
end
end
class Hello
include Greeting
end
h = Hello.new
puts h.hello('John') #=> Hello John
puts h.name #=> John
module Greeting
def self.hello name
@name = name
"Hello #{name}"
end
def self.name
@name
end
end
puts Greeting.hello('John') #=> Hello John
puts Greeting.name #=> John