ruby-uebungen/Assignment_032/solution/readme.md

14 lines
713 B
Markdown

# Lösung: Klassen per Reflection analysieren
<div style="border: 1px solid grey;"><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></div>```ruby
def analyze(clazz)
puts "Name: #{clazz.to_s}"
puts "Elternklasse: #{clazz.superclass}"
puts "Instanz-Methoden: #{clazz.instance_methods}"
puts "Statische-Methoden: #{clazz.singleton_methods}"
puts "Konstanten: #{clazz.constants}"
end
analyze(String)
```