Skip to content

Instantly share code, notes, and snippets.

@misfo
Created June 7, 2011 23:26
Show Gist options
  • Save misfo/1013431 to your computer and use it in GitHub Desktop.
Save misfo/1013431 to your computer and use it in GitHub Desktop.
class Mom
class << self
def defined_it?
method_defined? :the_method
end
end
end
class Son < Mom
class << self
def the_method
puts "definition!"
end
end
end
puts Mom.defined_it? # false
puts Son.defined_it? # false
class Mom
class << self
def defined_it?
respond_to? :the_method
end
end
end
class Son < Mom
class << self
def the_method
puts "definition!"
end
end
end
puts Mom.defined_it? # false
puts Son.defined_it? # true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment