Skip to content

Instantly share code, notes, and snippets.

@googya
Created May 6, 2011 12:03
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 googya/958830 to your computer and use it in GitHub Desktop.
Save googya/958830 to your computer and use it in GitHub Desktop.
作用域
class Kitty
class << self
puts "#{self.inspect} -- #{self.object_id}" #a点
def hello
puts "#{self.inspect} -- #{self.object_id}" #b点
puts "#{Kitty.inspect} -- #{Kitty.object_id}" #c点
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment