Skip to content

Instantly share code, notes, and snippets.

@revans
Created February 11, 2015 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save revans/8989139054ebda481fcb to your computer and use it in GitHub Desktop.
Save revans/8989139054ebda481fcb to your computer and use it in GitHub Desktop.
module Test
extend self
def name
@name ||= "My name"
end
def read
@name
end
end
Test.name # => "My name"
Test.read # => "My name"
class Demo
include Test
end
demo = Demo.new
demo.my # => "My name"
demo.read # => "My name"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment