Skip to content

Commit 61f9f5c

Browse files
committed
Merge pull request #1 from alexdowad/master
Just took a brief pass over chapter 4 and tweaked spelling/grammar...
2 parents b3be1dc + 6f062a1 commit 61f9f5c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

chapter04.textile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Ruby array class, `Array`, as an example.
5252
to `ruby` and the `c` that it is a class object. These naming rules
5353
are used everywhere in `ruby`.
5454

55-
This call to `rb_define_class()` allows to define `Array` that
55+
This call to `rb_define_class()` defines a class called `Array`, which
5656
inherits from `Object`. At the same time as `rb_define_class()` creates
5757
the class object, it also defines the constant. That means that after this
5858
you can already access `Array` from a Ruby program. It corresponds to
@@ -171,8 +171,8 @@ end
171171

172172
h3. Singleton methods definition
173173

174-
We can define methods that are specific to an instance of an
175-
object. They are called singleton methods. As I used `File.unlink` as
174+
We can define methods that are specific to a single object instance.
175+
They are called singleton methods. As I used `File.unlink` as
176176
an example in chapter 1 "Ruby language minimum", I first wanted to
177177
show it here, but for a particular reason we'll look at `File.link`
178178
instead.
@@ -217,7 +217,7 @@ made:
217217
(array.c)
218218
</pre>
219219

220-
The `Init` for the built-in functions are explicitely called during
220+
The `Init` for the built-in functions are explicitly called during
221221
the startup of `ruby`. This is done in `inits.c`.
222222

223223
▼ `rb_call_inits()`
@@ -244,7 +244,7 @@ the startup of `ruby`. This is done in `inits.c`.
244244

245245
This way, `Init_Array()` is called properly.
246246

247-
That explains it for built-in libraries, but what about extension
247+
That explains it for the built-in libraries, but what about extension
248248
libraries? In fact, for extension libraries the convention is the
249249
same. Take the following code:
250250

@@ -255,7 +255,7 @@ require "myextension"
255255
With this, if the loaded extension library is `myextension.so`, at
256256
load time, the (`extern`) function named `Init_myextension()` is
257257
called. How they are called is beyond the scope of this chapter. For
258-
that, you should read the chapter 18 "Load". Here we'll just end this
258+
that, you should read chapter 18, "Load". Here we'll just end this
259259
with an example of `Init`.
260260

261261
The following example is from `stringio`, an extension library
@@ -317,7 +317,7 @@ level.
317317
h3. `rb_singleton_class()`
318318

319319
Well, let's confirm what the singleton classes are made of. It's too
320-
simple to each time just show you the code of function so this time
320+
simple to just show you the code of a function each time so this time
321321
I'll use a new weapon, a call graph.
322322

323323
<pre class="emlist">
@@ -458,7 +458,7 @@ rb_singleton_class
458458
Here also `rb_class_boot()` is called. So up to that point, it's the
459459
same as in normal classes. What's going on after is what's different
460460
between normal classes and singleton classes, in other words the
461-
characteristics of singleton classes. If you everything's clear so
461+
characteristics of singleton classes. If everything's clear so
462462
far, we just need to read `rb_singleton_class()` and
463463
`rb_make_metaclass()`.
464464

@@ -523,7 +523,7 @@ half.
523523

524524
Everything that is handled in the first half are non-pointer `VALUE`s,
525525
in other words objects without an existing C structure. First,
526-
`Fixnum` and `Symbol` are explicitely picked. Then,
526+
`Fixnum` and `Symbol` are explicitly picked. Then,
527527
`rb_special_const_p()` is a function that returns true for non-pointer
528528
`VALUE`s, so there only `Qtrue`, `Qfalse` and `Qnil` should get
529529
caught. Other than that, there are no valid non-pointer value so a bug
@@ -779,7 +779,7 @@ this logic.
779779
h4. "Class is also an object"
780780

781781
"Everything is an object" is often used as advertising statement when
782-
speaking about Ruby. And as a part of that, "Classes are also object!"
782+
speaking about Ruby. And as a part of that, "Classes are also objects!"
783783
also appears. But these expressions often go too far. When thinking
784784
about these sayings, we have to split them in two:
785785

@@ -1197,7 +1197,7 @@ After `rb_define_class_id`, we can find the following:
11971197
st_add_direct(rb_class_tbl, id, klass);
11981198
</pre>
11991199

1200-
This part assigns the class to the constant. However, whichever the
1200+
This part assigns the class to the constant. However, whichever
12011201
way you look at it you do not see that. In fact, top-level classes are
12021202
separated from the other constants and regrouped in
12031203
`rb_class_tbl()`. The split is slightly related to the GC. It's not
@@ -1355,7 +1355,7 @@ If you create a class like this, we won't go through
13551355
`rb_define_class_id()` and the classpath won't be set. In this case,
13561356
`c` does not have any name, which is to say we get an unnamed class.
13571357

1358-
However, if later it's assigned into a constant, the name of this
1358+
However, if later it's assigned to a constant, the name of this
13591359
constant will be attached to the class.
13601360

13611361
<pre class="emlist">

0 commit comments

Comments
 (0)