Chapter 8. Strings, symbols, and other scalar objects
This chapter covers
- String object creation and manipulation
 - Methods for transforming strings
 - Symbol semantics
 - String/symbol comparison
 - Integers and floats
 - Time and date objects
 
The term scalar means one-dimensional. Here, it refers to objects that represent single values, as opposed to collection or container objects that hold multiple values. There are some shades of gray: strings, for example, can be viewed as collections of characters in addition to being single units of text. Scalar is to some extent in the eye of the beholder. Still, as a good first approximation, you can look at the classes discussed in this chapter as classes of one-dimensional, bite-sized objects, in contrast to the collection objects that will be the focus of the next chapter.
The built-in objects we’ll look at in this chapter include the following:
- Strings, which are Ruby’s standard way of handling textual material of any length
 - Symbols, which are (among other things) another way of representing text in Ruby
 - Integers
 - Floating-point numbers
 - Time, Date, and DateTime objects
 
All of these otherwise rather disparate objects are scalar—they’re one-dimensional, noncontainer objects with no further objects lurking inside them the way arrays have. This isn’t to say scalars aren’t complex and rich in their semantics; as you’ll see, they are.