2023-05-25 17:47:19 +02:00
|
|
|
# Lösung: Klassen per Reflection analysieren
|
2023-05-23 09:19:31 +02:00
|
|
|
|
2023-05-25 17:49:42 +02:00
|
|
|
|
|
|
|
```ruby
|
2023-05-25 17:47:19 +02:00
|
|
|
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)
|
|
|
|
```
|