Skip to content

Instantly share code, notes, and snippets.

@igaiga igaiga/self.rb
Created Aug 9, 2017

Embed
What would you like to do?
class Foo
p self #=> Foo (Fooクラス)
@bar = "hello!"
def foo
p self #=> #<Foo:0x007ff63a2471f0> (Fooクラスインスタンス)
p @bar = "hi!"
end
def self.foo
p self #=> Foo (Fooクラス)
p @bar #=> "hello!"
end
end
Foo.new.foo
Foo.foo
# Foo
# #<Foo:0x007fdd148eaf50>
# "hi!"
# Foo
# "hello!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.