Module: Asyncable

Defined in:
lib/asyncable.rb,
lib/asyncable/version.rb,
lib/asyncable/active_record_scopes.rb

Defined Under Namespace

Modules: ActiveRecordScopes, Statuses

Constant Summary collapse

VERSION =
"0.1.7"

Instance Method Summary collapse

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/asyncable.rb', line 26

def failed?
  status == Statuses::FAILED
end

#processing?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/asyncable.rb', line 30

def processing?
  status == Statuses::PROCESSING
end

#start_asyncObject

# === CLASS HOOKS === def self.async(method) end # === END CLASS HOOKS ===



16
17
18
19
20
# File 'lib/asyncable.rb', line 16

def start_async
  self.status = Statuses::PROCESSING
  save_to_db
  process_in_background
end

#succeeded?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/asyncable.rb', line 22

def succeeded?
  status == Statuses::SUCCEEDED
end