summaryrefslogtreecommitdiff
path: root/spec/ruby/core/fiber/fixtures/classes.rb
blob: 6b0e0fbc4261b8a613f42b5283bb7d6a69fda438 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module FiberSpecs

  class NewFiberToRaise
    def self.raise(*args, **kwargs, &block)
      fiber = Fiber.new do
        if block_given?
          block.call do
            Fiber.yield
          end
        else
          Fiber.yield
        end
      end

      fiber.resume

      fiber.raise(*args, **kwargs)
    end
  end

  class CustomError < StandardError; end
end