Skip to content

Instantly share code, notes, and snippets.

@havenwood
Created February 3, 2014 00:32
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 havenwood/8777236 to your computer and use it in GitHub Desktop.
Save havenwood/8777236 to your computer and use it in GitHub Desktop.
Exposing an instance variable.
module Mushroom
@color = :blue
def self.color
@color
end
def self.color=(this_color)
@color = this_color
end
end
Mushroom.color
#=> :blue
Mushroom.color = :periwinkle
Mushroom.color
#=> :periwinkle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment