Sha256: 95e78f6a28c36fae760a5e4beedd5f695d4a6b53780e5e5d5f6a1ad7dcec89eb

Contents?: true

Size: 423 Bytes

Versions: 2

Compression:

Stored size: 423 Bytes

Contents

class ThrowCatchJump < Exception
  def initialize(tag, val)
    @tag = tag
    @val = val
    super("uncaught throw :#{tag}")
  end
  def _tag
    @tag
  end
  def _val
    @val
  end
end

module Kernel
  def catch(tag, &block)
    block.call(tag)
  rescue ThrowCatchJump => e
    unless e._tag == tag
      raise e
    end
    return e._val
  end
  def throw(tag, val=nil)
    raise ThrowCatchJump.new(tag, val)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
script_core-0.3.2 ext/enterprise_script_service/mruby/mrbgems/mruby-catch/mrblib/catch.rb
script_core-0.3.0 ext/enterprise_script_service/mruby/mrbgems/mruby-catch/mrblib/catch.rb