Class: Lalka::InternalAsync

Inherits:
InternalBase show all
Defined in:
lib/lalka.rb

Instance Method Summary collapse

Methods inherited from InternalBase

#call, #on_error, #on_success, #try

Instance Method Details

#reject(error) ⇒ Object

Raises:

  • (ArgumentError)


203
204
205
206
207
# File 'lib/lalka.rb', line 203

def reject(error)
  raise ArgumentError, 'missing on_error block' if @on_error.nil?

  @on_error.call(error)
end

#resolve(value) ⇒ Object



195
196
197
198
199
200
201
# File 'lib/lalka.rb', line 195

def resolve(value)
  if @on_success.nil?
    reject(ArgumentError.new('missing on_success block'))
  else
    @on_success.call(value)
  end
end