Method: ActiveRecord::Promise#then

Defined in:
activerecord/lib/active_record/promise.rb

#then(&block) ⇒ Object

Returns a new ActiveRecord::Promise that will apply the passed block when the value is accessed:

Post.async_pick(:title).then { |title| title.upcase }.value
# => "POST TITLE"


36
37
38
# File 'activerecord/lib/active_record/promise.rb', line 36

def then(&block)
  Promise.new(@future_result, @block ? @block >> block : block)
end