Skip to content

Commit bc3d902

Browse files
committed
Docs: Fix problems with Fiber's docs
* References to Scheduler (was outdated to SchedulerInterface) * References between new methods (storage, [], []=) * Storage's call-sequence (rendered confusingly)
1 parent ce59571 commit bc3d902

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

cont.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,7 +1959,7 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval)
19591959
* the current thread, blocking and non-blocking fibers' behavior is identical.
19601960
*
19611961
* Ruby doesn't provide a scheduler class: it is expected to be implemented by
1962-
* the user and correspond to Fiber::SchedulerInterface.
1962+
* the user and correspond to Fiber::Scheduler.
19631963
*
19641964
* There is also Fiber.schedule method, which is expected to immediately perform
19651965
* the given block in a non-blocking manner. Its actual implementation is up to
@@ -2080,9 +2080,10 @@ storage_access_must_be_from_same_fiber(VALUE self)
20802080
}
20812081

20822082
/**
2083-
* call-seq: Fiber.current.storage -> hash (dup)
2083+
* call-seq: fiber.storage -> hash (dup)
20842084
*
2085-
* Returns a copy of the storage hash for the current fiber.
2085+
* Returns a copy of the storage hash for the fiber. The method can only be called on the
2086+
* Fiber.current.
20862087
*/
20872088
static VALUE
20882089
rb_fiber_storage_get(VALUE self)
@@ -2117,16 +2118,17 @@ fiber_storage_validate(VALUE value)
21172118
}
21182119

21192120
/**
2120-
* call-seq: Fiber.current.storage = hash
2121+
* call-seq: fiber.storage = hash
21212122
*
2122-
* Sets the storage hash for the current fiber. This feature is experimental
2123-
* and may change in the future.
2123+
* Sets the storage hash for the fiber. This feature is experimental
2124+
* and may change in the future. The method can only be called on the
2125+
* Fiber.current.
21242126
*
21252127
* You should be careful about using this method as you may inadvertently clear
21262128
* important fiber-storage state. You should mostly prefer to assign specific
2127-
* keys in the storage using Fiber#[]=.
2129+
* keys in the storage using Fiber::[]=.
21282130
*
2129-
* You can also use Fiber.new(storage: nil) to create a fiber with an empty
2131+
* You can also use <tt>Fiber.new(storage: nil)</tt> to create a fiber with an empty
21302132
* storage.
21312133
*
21322134
* Example:
@@ -2160,7 +2162,7 @@ rb_fiber_storage_set(VALUE self, VALUE value)
21602162
* The +key+ must be a symbol, and the value is set by Fiber#[]= or
21612163
* Fiber#store.
21622164
*
2163-
* See also Fiber[]=.
2165+
* See also Fiber::[]=.
21642166
*/
21652167
static VALUE
21662168
rb_fiber_storage_aref(VALUE class, VALUE key)
@@ -2183,7 +2185,7 @@ rb_fiber_storage_aref(VALUE class, VALUE key)
21832185
*
21842186
* +key+ must be a Symbol, otherwise a TypeError is raised.
21852187
*
2186-
* See also Fiber[].
2188+
* See also Fiber::[].
21872189
*/
21882190
static VALUE
21892191
rb_fiber_storage_aset(VALUE class, VALUE key, VALUE value)
@@ -2397,7 +2399,7 @@ rb_fiber_s_schedule_kw(int argc, VALUE* argv, int kw_splat)
23972399
*
23982400
* Note that the behavior described above is how the method is <em>expected</em>
23992401
* to behave, actual behavior is up to the current scheduler's implementation of
2400-
* Fiber::SchedulerInterface#fiber method. Ruby doesn't enforce this method to
2402+
* Fiber::Scheduler#fiber method. Ruby doesn't enforce this method to
24012403
* behave in any particular way.
24022404
*
24032405
* If the scheduler is not set, the method raises
@@ -2416,7 +2418,7 @@ rb_fiber_s_schedule(int argc, VALUE *argv, VALUE obj)
24162418
*
24172419
* Returns the Fiber scheduler, that was last set for the current thread with Fiber.set_scheduler.
24182420
* Returns +nil+ if no scheduler is set (which is the default), and non-blocking fibers'
2419-
# behavior is the same as blocking.
2421+
* behavior is the same as blocking.
24202422
* (see "Non-blocking fibers" section in class docs for details about the scheduler concept).
24212423
*
24222424
*/
@@ -2450,7 +2452,7 @@ rb_fiber_current_scheduler(VALUE klass)
24502452
* thread will call scheduler's +close+ method on finalization (allowing the scheduler to
24512453
* properly manage all non-finished fibers).
24522454
*
2453-
* +scheduler+ can be an object of any class corresponding to Fiber::SchedulerInterface. Its
2455+
* +scheduler+ can be an object of any class corresponding to Fiber::Scheduler. Its
24542456
* implementation is up to the user.
24552457
*
24562458
* See also the "Non-blocking fibers" section in class docs.

0 commit comments

Comments
 (0)