Skip to content

Instantly share code, notes, and snippets.

@Momozono
Created June 30, 2015 04:18
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 Momozono/62beabdac01053e0b67f to your computer and use it in GitHub Desktop.
Save Momozono/62beabdac01053e0b67f to your computer and use it in GitHub Desktop.
word = $stdin.gets.chomp
n = eval(word)
limit = n.ancestors.length - 1
class_array = []
for i in 0..limit
class_array << n.ancestors[i] if n.superclass != nil
end
num = class_array.length - 1
class_array.each do |value|
puts "#{num} : #{value}"
num -= 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment