Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Start a free Basic trial
to watch this video
Ruby Core contains the classes and modules that come with Ruby and make Ruby work. For example, Ruby Core contains many familiar classes that you have worked with so far: Array, Hash, Fixnum, and more.
Links
-
0:05
Ruby Core contains the classes and modules that come with Ruby and make Ruby work.
-
0:10
For example, Ruby Core contains many familiar classes that you've worked with
-
0:15
so far, things like Array, Hash, Fixnum, and more.
-
0:21
Let's take a look at some of what Ruby Core has to offer now using workspaces.
-
0:26
So here is the Ruby Core documentation.
-
0:29
Now, you'll find a link to this in the notes right below the video.
-
0:34
So, you can go ahead and look that up and follow along.
-
0:37
Now, when we look at the documentation, on the left side here, right on top,
-
0:41
the first thing that we have is a list of files.
-
0:45
This documentation format is relatively standard for Ruby Core,
-
0:50
standard library, and even some gems.
-
0:53
Here we see on the left side,
-
0:54
that is all of the different files that would be in this package.
-
0:58
And right now these are just documentation links.
-
1:03
Here is where documentation gets good.
-
1:06
On the left side,
-
1:07
we have all of the different classes that are part of Ruby Core.
-
1:12
Some of these are going to look very familiar, like Array.
-
1:16
I'm gonna go ahead and click on this here and we can see the Array documentation.
-
1:22
Once we are inside of the Array documentation,
-
1:26
we get a list of methods all the way down on the left side here.
-
1:30
This is going to be the different instance methods that are supported by Arrays.
-
1:37
On the right side of the documentation, there will be an introduction.
-
1:41
This isn't the same for every single class and module in Ruby Core however,
-
1:47
there could be some nice examples in this part of the documentation.
-
1:52
So we some examples of using an Array and what can be inside of an Array.
-
1:57
Sometimes the documentation will give you little hints about how to use a class or
-
2:03
module, and here is an example of that.
-
2:08
If we wanna create an Array with separate objects,
-
2:11
a block can be passed in to the Array instead.
-
2:16
Now, if I hit the Back button, you can see there are more classes and
-
2:20
modules that you might be familiar with.
-
2:23
For example, Strings as part of Ruby Core.
-
2:28
On the right side of the documentation
-
2:31
are all of the different methods that are found in Ruby Core.
-
2:37
These will have parenthesis on the ride side that shows you what class or
-
2:42
module they come from.
-
2:45
And, if we want to, we can filter these classes and methods.
-
2:50
For example, if we wanted to see what classes and
-
2:53
modules contained the word Object, we could do that.
-
2:57
The methods can be interesting, too.
-
2:59
If we want to filter the methods to see what's supported, for
-
3:03
example the to_s method which converts something to a String.
-
3:07
We can see all of these different classes and modules support the to_s method.
-
3:15
Also to_i, to convert something to an integer.
-
3:19
To_f for floating point.
-
3:23
To_a for Array and to_h for Hatch.
-
3:30
It's good to be familiar with the different classes and
-
3:33
modules that are part of Ruby Core.
-
3:37
Go ahead and
-
3:38
take a look at all of the different ones here on the left side of the screen.
-
3:43
Try looking around at the Ruby Core classes on your own now using Workspaces.
You need to sign up for Treehouse in order to download course files.
Sign up