Un atelier Ruby · Édition d'ApprentissageA Ruby Workshop · Learning Edition

method_missing, ou répondre à ce qu'on n'a pas écrit method_missing, or answering what you never wrote

Au bout de la chaîne d'ancêtres, quand rien n'a répondu, Ruby appelle method_missing. Le redéfinir intercepte les messages inconnus — mais jamais sans son jumeau respond_to_missing?, sinon l'objet ment au duck typing. Et seulement pour un ensemble ouvert : le connu se génère. At the end of the ancestor chain, when nothing answered, Ruby calls method_missing. Redefining it intercepts unknown messages — but never without its twin respond_to_missing?, or the object lies to duck typing. And only for an open set: the known is generated.

AudienceAudience
Dev tenté par l'objet magique, prêt à en mesurer le prix Dev tempted by the magic object, ready to weigh its price
Format
Self-paced
ChapitresChapters
5
Date
Avr 2026 Apr 2026
≈ 18 min ●●●○ method_missingrespond_to_missing?Proxy
🔒

La suite est réservée The rest is members-only

Le premier numéro est libre. Débloque tout The Ruby Loop — tous les volumes, à vie — pour 5 €, paiement unique. The first issue is free. Unlock all of The Ruby Loop — every volume, forever — for €5, one-time.

Retour au kiosqueBack to newsstand