Skip to Content
Customizing Chef
book

Customizing Chef

by Jon Cowie
August 2014
Intermediate to advanced
388 pages
9h 49m
English
O'Reilly Media, Inc.
Content preview from Customizing Chef

Chapter 2. Just Enough Ruby to Customize Chef

Tip

If you’re already familiar with object-oriented programming with Ruby, including inheritance, namespaces, exceptions, and the Ruby scoping model, then you may wish to skip this chapter.

As you’ll most likely already have realized while writing cookbooks and recipes, the amount of actual Ruby knowledge needed to write Chef recipes is relatively light. The out-of-the-box resources provided with Chef do an excellent job of abstracting away many of the common tasks required, and a smattering of Ruby basics such as assigning values to variables and writing if statements fill in the gaps. But there’s a lot more going on under the hood to provide those Chef resources, Knife plugins, and libraries, and before we can customize them, it is necessary to understand them.

This chapter will teach you some fundamental Ruby concepts that are essential knowledge for customizing Chef. I’ve tried to make the material in this chapter as accessible as possible to those new to Ruby, but as I only have a limited space in which to present some sizable concepts, don’t worry if it feels like a little too much to take in all at once.

Needless to say, this chapter will not cover everything there is to know about the Ruby programming language, and throughout the course of the book I’ll be introducing some additional Ruby concepts and expanding on those covered here—the aim of this chapter is simply to give you a good foundation to build on as we work through the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Mastering Chef

Mastering Chef

Mayank Joshi
Automation through Chef Opscode

Automation through Chef Opscode

Navin Sabharwal, Manak Wadhwa
The Hidden Cost of AI-Assisted Creativity

The Hidden Cost of AI-Assisted Creativity

Léonard Boussioux, Anil Doshi, Oliver Hauser, Kartik Hosanagar

Publisher Resources

ISBN: 9781491903612Errata Page