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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.handle_asynchronously(method) ⇒ Object

CLASS HOOKS ===



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

def self.handle_asynchronously(method)
end

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

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