loading
main.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Demo of the pure OOP foundation of Ruby
def classify (anything_in_ruby)
  supers = []
  current = anything_in_ruby.class.superclass
  while current.superclass
    supers.push(current)
    current = current.superclass
  end
  puts "#{anything_in_ruby} is an instance of #{anything_in_ruby.class} inheriting from #{supers}"
end

classify 4
classify 4.0
classify false
classify "bingo"
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]