Metaprogramming ऐसा code लिखना है जो runtime पर code लिखता या modify करता है — methods को dynamically define करना, undefined methods का जवाब देना, और on the fly classes का निरीक्षण/परिवर्तन करना। Ruby की dynamic प्रकृति (सब कुछ एक object है, classes सहित) इसे metaprogramming में असाधारण रूप से अच्छा बनाती है, जो Rails के अधिकांश "magic" को powered करता है।
Methods को dynamically define करना
[, , ].each ||
(attribute)
instance_variable_get()
() ||
instance_variable_set(, value)
