Skip to content

Instantly share code, notes, and snippets.

@karapetyan
Last active September 24, 2015 14:49
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 karapetyan/485e102e9173f54544f8 to your computer and use it in GitHub Desktop.
Save karapetyan/485e102e9173f54544f8 to your computer and use it in GitHub Desktop.
class Person
@var = 13 # instance_class_variable
@@var = 15 # class variable
def self.class_method
puts "access from class method: #{@var}"
puts "access from class method: #{@@var}"
end
def instance_method
puts "access from instance method: #{@var}"
puts "access from instance method: #{@@var}"
end
end
Person.class_method
x = Person.new
x.instance_method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment