BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Article: Adding Properties to Ruby Metaprogramatically

Article: Adding Properties to Ruby Metaprogramatically

We're proud to publish a feature article by InfoQ's own Werner Schuster, where he walks us through a very simple and familiar example of adding Java-style properties support (declarative getters, setters and change listeners) to Ruby classes. He does so via a Mixin and using elements of Ruby meta-programming. Taking the idea a step forward, he gently guides the reader into usage of design-by-contract principles and gives a teasing taste of what a pluggable type system might look like in a Ruby setting.

If you're coming over to Ruby from the Java world, and want a good primer on what metaprogramming is all about, then definitely read Adding Properties to Ruby Metaprogramatically today.

Rate this Article

Adoption
Style

BT