How to use Ruby1.9 for shoes?

The shoes wrap their own Ruby rig, right?

I cannot use Fiber, which is a Ruby1.9 feature. And I want to use Fiber to create a generator.

Here is my code (so you can be sure the problem is not my code):

class BrownianGenerator
  def initialize
    @x = 0
    @fiber = Fiber.new do
      loop do 
        @x = @x+rand; 
        Fiber.yield @x
      end
    end
  end
  def next; @fiber.resume end
  def rewind; @x=0 end
end

      

and if i made a shoe app like this:

Shoes.app do
  @b = BrownianGenerator.new
end

      

If I lift up the shoe console I see the error:

uninitialized constant #<class:0xblah>::BrownianGenerator::Fiber

      

Since it says Fiber is an uninitialized constant, there is either something wrong with my code, or this Ruby version is unaware of the Fiber class - the latter should be the case.

I have looked into this question about determining the Ruby version (this is 1.8 for my mac installation), but I don't know how to change the version.

+2


source to share


3 answers


or you can use aman gupta "poor fiber" or try to do: Fiber or not. GL! -r



+1


source


Check out Green Shoes .



This functionality is based on _why's original implementation, but it's packed like a gem and built specifically for 1.9.

+2


source


So I jumped into freenode #shoes and found out that nightly shoe build uses Ruby1.9. I haven't had time to try to create one yet, but this should solve my problem.

+1


source







All Articles