Class: Object

Inherits:
BasicObject
Defined in:
lib/opal/aasm.rb

Overview

Last but not least add catch/throw to Opal as these are currently missing (as of version 8.beta) There is a PR to bring these into Opal properly.

Defined Under Namespace

Classes: CatchThrow

Instance Method Summary collapse

Instance Method Details

#catch(sym) ⇒ Object



137
138
139
140
141
142
# File 'lib/opal/aasm.rb', line 137

def catch(sym)
  yield
rescue CatchThrow => e
  return e.arg if e.sym == sym
  raise e
end

#throw(*args) ⇒ Object

Raises:



144
145
146
# File 'lib/opal/aasm.rb', line 144

def throw(*args)
  raise CatchThrow.new(args)
end