Skip to content

Instantly share code, notes, and snippets.

@igaiga
Created August 9, 2017 00:24
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 igaiga/0aa3859e50a3d7ceaa74f9f2c67ea6a0 to your computer and use it in GitHub Desktop.
Save igaiga/0aa3859e50a3d7ceaa74f9f2c67ea6a0 to your computer and use it in GitHub Desktop.
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