You know writing DSLs in Ruby is powerful and flexible, but aren't sure exactly how to get started.

The worst part of attempting to write a DSL is worrying that you'll get stuck without knowing where to turn. What's the difference between class_eval and instance_eval? And how do you know when to use them?

Taking control of your project with custom DSLs would make your code so much more expressive

Learn to make code that expresses your team's shared understanding of a business problem.

Projects like Ruby on Rails provide sensible DSLs for managing relationships between models in your system. The Sinatra framework gives you a DSL to provide affordances in your code so that web requests are handled the way you expect. Chef was created as a DSL for managing server configurations

You can model your project's needs with you own DSL too.

From the author of Clean Ruby, Ruby DSL Handbook gives you the knowledge you need to build the right tool for your business domain.

Ruby DSL Handbook will give you the knowledge and experience to create expressive programs.

Use business terms in code that make sense to you and your team; read Ruby DSL Handbook and bend your code to demands of your business.

Michael Buckbee “I learned some new aspects of Ruby I was able to apply the very same day” —Michael Buckbee

Jeff Dickey“If you're a journeyman-or-better craftsman in any real OO language coming to Ruby, Jim Gay is one of three or four guys you'll want to read avidly, just to keep your sanity.” —Jeff Dickey

Get your team on the same page. Free your mind with the ability to create code that represents your ideas better. Remove the often distracting boilerplate code and wrap up your concepts in easy to use methods.

What's inside the package?

Ruby DSL Handbook is currently being written and you'll receive regular updates as the content is updated.

The Complete Package

Grab a copy to:

  • Get started quickly. Begin by learning about creating methods that reflect a concept from your domain.
  • Manage customizing your DSL. Create code that allows for easy alterations for when concepts aren't implemented exactly as expected.
  • Evaluate generated code. Dive into class_eval and instance_eval and know the trade-offs in designing your DSL.
  • Dynamically define methods. Understand when to use method_missing, define_method and other approaches to handling messages.
  • Understand antipatterns. After you've read through the recommendations for building your own DSL, take a look at some examples of what not to do.
  • Read popular project evaluations. Take a look at popular Ruby open source projects to see how they've implemented DSLs.

Screencasts

See a how the metaprogramming can become a simple tool as support for DSL methods are built. See the benefits to properly structruing generated methods to allow for easy debugging.

Sample code and Cheatsheets

Get a handle on the samples from the book to use in your own projects. Read through the test code. Keep a quick refrence for instance_eval, module_eval, class_eval, instance_exec, module_exec, and class_exec, and more.

Ebook in PDF, ePub, and mobi (and NO DRM)

Pick up the easy to read ebook and take it with you everywhere. Read about how Ruby works to help you create interfaces that reflect your needs and read about open source projects and how they implement their DSL code.

packages

Pick it up now and get all updates for $119. You'll be automatically updated as new content is added.

Get the complete package now

Or get the package and share with your entire team for only $599.

Jim Nanney “With Jim's new book, Ruby DSL Handbook, he has once again tackled a difficult to understand problemspace in Ruby and brought it into readily understandable examples and explanations. His grasp upon the language comes out in force, in a way that even beginners can understand. Reading this book opened my eyes to different ways to tackle DSLs. It immediately had me wanting to explore different ways of reimplementing one of my own.” —Jim Nanney

Ruby DSL Plus Package

Grab a copy to:

  • Get started quickly. Begin by learning about creating methods that reflect a concept from your domain.
  • Manage customizing your DSL. Create code that allows for easy alterations for when concepts aren't implemented exactly as expected.
  • Evaluate generated code. Dive into class_eval and instance_eval and know the trade-offs in designing your DSL.
  • Dynamically define methods. Understand when to use method_missing, define_method and other approaches to handling messages.
  • Understand antipatterns. After you've read through the recommendations for building your own DSL, take a look at some examples of what not to do.
  • Read popular project evaluations. Take a look at popular Ruby open source projects to see how they've implemented DSLs.

Sample code and Cheatsheets

Get a handle on the samples from the book to use in your own projects. Read through the test code. Keep a quick refrence for instance_eval, module_eval, class_eval, instance_exec, module_exec, and class_exec, and more.

Ebook in PDF, ePub, and mobi (and NO DRM)

Pick up the easy to read ebook and take it with you everywhere. Read about how Ruby works to help you create interfaces that reflect your needs and read about open source projects and how they implement their DSL code.

packages

Pick it up now and get all updates for $47. You'll be automatically updated as new content is added.

Get the plus package now

Just the Ruby DSL Handbook

Ebook in PDF, ePub, and mobi (and NO DRM)

Pick up the easy to read ebook and take it with you everywhere. Read about how Ruby works to help you create interfaces that reflect your needs and read about open source projects and how they implement their DSL code.

packages

Get Ruby DSL Handbook for the cost of few trips to the coffee shop at only $24 in PDF and ePub. Get it that cheap for a limited time only. You'll be automatically updated as new content is added.

Get just the ebook now

What about updates?

You'll automatically get updates as the book and extras are updated. The email you use to purchase will receive all notifications when newer versions are released. Buying now means you'll be notified via email as updates are regularly made.

Share it with your team

If your whole team needs to tackle the problem, grab a Team License copy get started. Buy a Team ebook License

About Jim Gay

jim-gay-headshot-small Jim is the author of Clean Ruby, and the Lead Developer for Radiant CMS and is a prolific contributor to it and many open-source projects. At Saturn Flyer LLC he’s built numerous Radiant sites, custom applications, and award winning graphic design and has had his designs published in HOW Magazine and The Best of LogoLounge. He’s been a co-host of the Ruby 5 podcast, speaker at RubyConf 2013, RubyConf 2014, Ruby Kaigi, Wroclove.rb, ArrrrCamp, and RubyNation, co-founder of Arlington Ruby and has been professionally building Ruby and Rails applications since 2006.

What people are saying:

Ryan Wilcox “Jim is one of those rare people who can crank out award winning site designs, go and implement the backend Rails functionality, and be lead engineer for his project team… all on one project. I’ve seen him do it.

Jim is someone to watch out for, and get on your project if you can. (Especially with his upcoming book, which I think will rock the Ruby on Rails world a little bit, changing how the community thinks about large/complex Rails codebases.).“ — Ryan Wilcox, Owner, Principal Engineer at Wilcox Development Solutions and former co-worker

Free Building DSLs Course

Get a free email introduction course to building DSLs for your project.
1 email each day for 5 days.