Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Ruby Foundations Ruby Core Enumerable

Matthew Main
Matthew Main
7,566 Points

What are the syntax rules following "require" in Ruby?

Earlier in this lesson, "time" is required in irb using the syntax:

    require 'time'

Here, "enumerable" is required inside a class using the syntax:

    require Enumerable

When do you need to require using the lower-case/single-quote syntax, and when do you need to use the title-case syntax?

1 Answer

Daniel Cunningham
Daniel Cunningham
21,109 Points

In most cases, when you a requiring something into your ruby files, you'll be using single quotes. Enumerable is a module in Ruby Core, while Date is actually a class. Because Enumerable is a module and part of Ruby Core, it's gets some 'special treatment' when being required in the syntax. A lot of Gems that you will end up pulling will be 'required' using single quotes. <br>

http://ruby-doc.org/core-2.2.2/Enumerable.html <br>

http://ruby-doc.org/core-1.9.3/Time.html <br>