123456789_123456789_123456789_123456789_123456789_

Class: ActiveRecord::FutureResult

Do not use. This class is for internal use only.
Relationships & Source Files
Namespace Children
Classes:
Inherits: Object
Defined in: activerecord/lib/active_record/future_result.rb

Constant Summary

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(intent) ⇒ FutureResult

[ GitHub ]

  
# File 'activerecord/lib/active_record/future_result.rb', line 42

def initialize(intent)
  @intent = intent
end

Class Method Details

.wrap(result)

[ GitHub ]

  
# File 'activerecord/lib/active_record/future_result.rb', line 30

def self.wrap(result)
  case result
  when self, Complete
    result
  else
    Complete.new(result)
  end
end

Instance Attribute Details

#canceled?Boolean (readonly)

[ GitHub ]

  
# File 'activerecord/lib/active_record/future_result.rb', line 64

def canceled?
  @intent.canceled?
end

#lock_wait (readonly)

[ GitHub ]

  
# File 'activerecord/lib/active_record/future_result.rb', line 40

delegate :lock_wait, to: :@intent

#pending?Boolean (readonly)

[ GitHub ]

  
# File 'activerecord/lib/active_record/future_result.rb', line 60

def pending?
  @intent.pending?
end

Instance Method Details

#cancel

[ GitHub ]

  
# File 'activerecord/lib/active_record/future_result.rb', line 50

def cancel
  @intent.cancel
end

#empty?Boolean

[ GitHub ]

  
# File 'activerecord/lib/active_record/future_result.rb', line 39

delegate :empty?, :to_a, to: :result

#result

Raises:

[ GitHub ]

  
# File 'activerecord/lib/active_record/future_result.rb', line 54

def result
  raise Canceled if canceled?

  @intent.cast_result
end

#then(&block)

[ GitHub ]

  
# File 'activerecord/lib/active_record/future_result.rb', line 46

def then(&block)
  Promise.new(self, block)
end

#to_a

[ GitHub ]

  
# File 'activerecord/lib/active_record/future_result.rb', line 39

delegate :empty?, :to_a, to: :result