Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No docs for methods on Fiber #15

Closed
dgutov opened this issue Jun 25, 2013 · 4 comments
Closed

No docs for methods on Fiber #15

dgutov opened this issue Jun 25, 2013 · 4 comments

Comments

@dgutov
Copy link
Contributor

dgutov commented Jun 25, 2013

Here's a session using version 0.4.6:

[8] pry(main)> show-doc Fiber.yield
NameError: undefined method `yield' for class `Class'
from /home/gutov/.rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/pry-doc-0.4.6/lib/pry-doc.rb:49:in `method'
[8] pry(main)> show-doc Fiber.current
NameError: undefined method `current' for class `Class'
from /home/gutov/.rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/pry-doc-0.4.6/lib/pry-doc.rb:49:in `method'
[8] pry(main)> show-doc Fiber#transfer
Error: Cannot locate this method: transfer. (source_location returns nil)
@banister
Copy link
Member

It all works fine for me:

[36] pry(main)> ? Fiber.yield

From: cont.c (C Method):
Owner: #<Class:Fiber>
Visibility: public
Signature: yield(*arg1)
Number of lines: 5

Yields control back to the context that resumed the fiber, passing
along any arguments that were passed to it. The fiber will resume
processing at this point when resume is called next.
Any arguments passed to the next resume will be the
value that this Fiber.yield expression evaluates to.
[37] pry(main)> PryDoc::VERSION
=> "0.4.6"
[38] pry(main)> ? Fiber.current
Error: Couldn't locate a definition for Fiber.current!
[39] pry(main)> require 'fiber'
=> true
[40] pry(main)> ? Fiber.current

From: cont.c (C Method):
Owner: #<Class:Fiber>
Visibility: public
Signature: current()
Number of lines: 3

Returns the current fiber. You need to require 'fiber'
before using this method. If you are not running in the context of
a fiber this method will return the root fiber.
[41] pry(main)> ? Fiber#transfer

From: cont.c (C Method):
Owner: Fiber
Visibility: public
Signature: transfer(*arg1)
Number of lines: 39

Transfer control to another fiber, resuming it from where it last
stopped or starting it if it was not resumed before. The calling
fiber will be suspended much like in a call to
Fiber.yield. You need to require 'fiber'
before using this method.

The fiber which receives the transfer call is treats it much like
a resume call. Arguments passed to transfer are treated like those
passed to resume.

You cannot resume a fiber that transferred control to another one.
This will cause a double resume error. You need to transfer control
back to this fiber before it can yield and resume.

Example:

  fiber1 = Fiber.new do
    puts 38;5;107mIn Fiber 1"
    Fiber.yield
  end

  fiber2 = Fiber.new do
    puts "In Fiber 2"
    fiber1.transfer
    puts "Never see this message"
  end

  fiber3 = Fiber.new do
    puts "In Fiber 3"
  end

[42] pry(main)> 

@dgutov
Copy link
Contributor Author

dgutov commented Jun 25, 2013

[5] pry(main)> PryDoc::VERSION
=> "0.4.6"
[7] pry(main)> Pry::VERSION
=> "0.9.12.2"
[8] pry(main)> ? Fiber.current
Error: Couldn't locate a definition for Fiber.current!
[9] pry(main)> ? Fiber#resume
Error: Cannot locate this method: resume. (source_location returns nil)
[10] pry(main)> require 'fiber'
=> true
[11] pry(main)> ? Fiber#resume
Error: Cannot locate this method: resume. (source_location returns nil)
[12] pry(main)> ? Fiber.current
NameError: undefined method `current' for class `Class'
from /home/gutov/.rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/pry-doc-0.4.6/lib/pry-doc.rb:49:in `method'
[12] pry(main)> ? Fiber#transfer
Error: Cannot locate this method: transfer. (source_location returns nil)
[13] pry(main)> require 'pry-doc'
=> false
[14] pry(main)> ? Fiber#transfer
Error: Cannot locate this method: transfer. (source_location returns nil)
[15] pry(main)> 

Could this have been fixed post-0.4.6?

@kyrylo
Copy link
Member

kyrylo commented Jun 25, 2013

No. It works only on Ruby 2.

@dgutov
Copy link
Contributor Author

dgutov commented Mar 8, 2014

If anything, I guess it's a bug in YARD (being unable to parse the docs from the 1.9.3 sources), so closing.

@dgutov dgutov closed this as completed Mar 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants