Skip to content

Instantly share code, notes, and snippets.

@michael-reeves
Last active August 29, 2015 14:22
Show Gist options
  • Save michael-reeves/a4cb85116cd032f60df5 to your computer and use it in GitHub Desktop.
Save michael-reeves/a4cb85116cd032f60df5 to your computer and use it in GitHub Desktop.
Exploring self
puts "Top Level"
puts "self is #{self}"
class C
puts "Class definition block:"
puts "self is #{self}"
def self.x
puts "Class method C.x:"
puts "self is #{self}"
end
def m
puts "Instance method C#m"
puts "self is #{self}"
end
end
C.x
C.new.m
class D < C
end
D.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment