Class: Promise

Inherits:
Object show all
Defined in:
lib/opal/promise_patch/version.rb,
lib/opal/promise_patch/promise_patch.rb

Constant Summary collapse

VERSION =
"0.0.2"

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/opal/promise_patch/promise_patch.rb', line 15

def method_missing(method_name, *args, &block)
  self.then do |result|
    result.send(method_name.to_sym, *args, &block)
  end.fail do |error|
    raise error
  end
end