Last active
September 24, 2015 14:49
-
-
Save karapetyan/485e102e9173f54544f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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