O'Reilly logo

Learning Sinatra by Manoj Sehrawat, Sudeep Agarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Ruby data types

Let's go through some of the data types in Ruby. You might be familiar with most of them.

Strings

Strings in Ruby are like strings in any other language. Though Ruby provides a lot of methods on the String object, for any string, you have a variety of handy methods such as upcase, downcase, swapcase, capitalize, split, reverse, size, gsub, and so on.

You might have guessed what these methods do. Use irb to try out these methods and other methods on the String object.

Numbers

Numbers comprise of Integers and Floats. Integers in Ruby are objects of the Fixnum class while floats are objects of the Float class.

Apart from the standard mathematical operators that you can apply on these objects, there are various other methods such as the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required