class Promise

Meta-programming String for Syntactic Sugars Referenced from Qiita

Public Class Methods

new(&callback) click to toggle source

Init a Promise @param [Proc] callback an async method

# File lib/murasaki/promise.rb, line 7
def initialize(&callback)
  @callback = callback
end

Public Instance Methods

then(&resolve) click to toggle source

Define what to do after a method callbacks @param [Proc] resolve what on callback @return [nil] nil

# File lib/murasaki/promise.rb, line 14
def then(&resolve)
  @callback.call(resolve)
end