What Readers Are Saying About Metaprogramming Ruby
Reading this book was like diving into a new world of thinking. I tried
a mix of Java and JRuby metaprogramming on a recent project. Using
Java alone would now feel like entering a sword fight carrying only
a banana, when my opponent is wielding a one-meter-long Samurai
blade.
Sebastian Hennebrüder
Java Consultant and Trainer, laliluna.de
This Ruby book fills a gap between language reference manuals and
programming cookbooks. Not only does it explain various meta-
programming facilities, but it also shows a pragmatic way of making
software smaller and better. There’s a caveat, though; when the new
knowledge sinks in, programming in more mainstream languages will
start feeling like a chore.
Jurek Husakowski
Software Designer, Philips Applied Technologies
Before this book, I’d never found a clear organization and explanation
of concepts like the Ruby object model, closures, DSLs definition, and
eigenclasses all spiced with real-life examples taken from the gems we
usually use every day. This book is definitely worth reading.
Carlo Pecchia
Software Engineer
I’ve had a lot of trouble finding a good way to pick up these meta-
programming techniques, and this book is bar none the best way to
do it. Paolo Perrotta makes it painless to learn Ruby’s most complex
secrets and use them in practical applications.
Chris Bunch
Software Engineer
Metaprogramming Ruby
Program Like the Ruby Pros
Paolo Perrotta
The Pragmatic Bookshelf
Raleigh, North Carolina Dallas, Texas
Many of the designations used by manufacturers and sellers to distinguish their prod-
ucts are claimed as t rademarks. Where those designations appear in this book, and The
Pragmatic Programmers, LLC was aware of a trademark claim, the designations have
been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The
Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf and the linking g
device are trademarks of The Pragmatic Programmers, LLC.
Every precaution was taken in the preparation of this book. However, the publisher
assumes no responsibility for errors or omissions, or for damages that may result from
the use of information (including program listings) contained herein.
Our Pragmatic courses, workshops, and other products can help you and your team
create better software and have more fun. For more information, as well as the latest
Pragmatic titles, please visit us at
http://www.pragprog.com
Copyright
©
2010
Paolo Perrotta.
All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmit-
ted, in any form, or by any means, electronic, mechanical, photocopying, recording, or
otherwise, without the prior consent of the publisher.
Printed in the United States of America.
ISBN-10: 1-934356-47-6
ISBN-13: 978-1-934356-47-0
Printed on acid-free paper.
P1.0 printing, January 2010
Version: 2010-1-29
To Carlo.