In Ruby (il linguaggio), super è una keyword che chiama il metodo di una classe genitore. Non c'entra nulla con l'oggetto Pokémon "Super Rod".
class Vehicle def initialize(brand) @brand = brand end def start puts "Starting #{@brand} vehicle..." end end class Car < Vehicle def start super # calls Vehicle#start puts "Engine started. Ready to drive!" end end Car.new("Toyota").start # Output: # Starting Toyota vehicle... # Engine started. Ready to drive!
super invoca il metodo omonimo nella superclasse.super() chiama senza argomenti; super(args) passa argomenti esplicitamente.super, il metodo figlio sovrascrive completamente quello del genitore.Questo è comportamento standard single-inheritance in Ruby.