Skip to content

Instantly share code, notes, and snippets.

@vireshas
Last active November 21, 2017 10:33
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 vireshas/138a4c9b92aaa877f615fa3193e70578 to your computer and use it in GitHub Desktop.
Save vireshas/138a4c9b92aaa877f615fa3193e70578 to your computer and use it in GitHub Desktop.
@ and self
#colleague asks
class A
attr_accessor :b,:d
def a
self.b = 10
@d = 20
end
def p
puts self.b
puts @b
puts self.d
end
end
a = A.new
a.a
a.p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment