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.8"

Instance Method Summary collapse

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


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

def failed?
  status == Statuses::FAILED
end

#processing?Boolean

Returns:

  • (Boolean)


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

def processing?
  status == Statuses::PROCESSING
end

#start_asyncObject



11
12
13
14
15
# File 'lib/asyncable.rb', line 11

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

#succeeded?Boolean

Returns:

  • (Boolean)


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

def succeeded?
  status == Statuses::SUCCEEDED
end