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
18,343 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> <br> <br>