Skip to content

Instantly share code, notes, and snippets.

@divoxx
Created March 25, 2014 20:19
Show Gist options
  • Save divoxx/9770489 to your computer and use it in GitHub Desktop.
Save divoxx/9770489 to your computer and use it in GitHub Desktop.
class Bar
def self.bar
@bar ||= "bar"
end
def self.baz
@@baz ||= "baz"
end
def bar
@bar
end
def baz
@@baz
end
end
Bar.bar # => "bar"
Bar.new.bar # => nil
Bar.baz # => "baz"
Bar.new.baz # => "baz"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment