Class: Operationable::Runners::Base
- Inherits:
-
Object
- Object
- Operationable::Runners::Base
- Defined in:
- lib/operationable/runners/base.rb
Instance Attribute Summary collapse
-
#callbacks ⇒ Object
readonly
Returns the value of attribute callbacks.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #check_status? ⇒ Boolean
- #ensure_enqueue ⇒ Object
-
#initialize(record, params, result, user) ⇒ Base
constructor
A new instance of Base.
- #job_async_execute_method ⇒ Object
- #job_class ⇒ Object
- #job_method ⇒ Object
- #job_sync_execute_method ⇒ Object
- #persist? ⇒ Boolean
- #persist_operation ⇒ Object
- #run ⇒ Object
- #store_callback(q_options) ⇒ Object
Constructor Details
#initialize(record, params, result, user) ⇒ Base
Returns a new instance of Base.
7 8 9 10 11 12 13 14 15 |
# File 'lib/operationable/runners/base.rb', line 7 def initialize(record, params, result, user) @record = record @params = params @result = result @user = user @callbacks = [] initialize_callbacks end |
Instance Attribute Details
#callbacks ⇒ Object (readonly)
Returns the value of attribute callbacks.
5 6 7 |
# File 'lib/operationable/runners/base.rb', line 5 def callbacks @callbacks end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
5 6 7 |
# File 'lib/operationable/runners/base.rb', line 5 def params @params end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
5 6 7 |
# File 'lib/operationable/runners/base.rb', line 5 def record @record end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
5 6 7 |
# File 'lib/operationable/runners/base.rb', line 5 def result @result end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
5 6 7 |
# File 'lib/operationable/runners/base.rb', line 5 def user @user end |
Instance Method Details
#check_status? ⇒ Boolean
26 27 28 |
# File 'lib/operationable/runners/base.rb', line 26 def check_status? true end |
#ensure_enqueue ⇒ Object
37 38 39 |
# File 'lib/operationable/runners/base.rb', line 37 def ensure_enqueue end |
#job_async_execute_method ⇒ Object
53 54 55 |
# File 'lib/operationable/runners/base.rb', line 53 def job_async_execute_method :perform_later end |
#job_class ⇒ Object
45 46 47 |
# File 'lib/operationable/runners/base.rb', line 45 def job_class 'OperationJob' end |
#job_method ⇒ Object
41 42 43 |
# File 'lib/operationable/runners/base.rb', line 41 def job_method "#{job_class}".constantize.method(perform_method) end |
#job_sync_execute_method ⇒ Object
49 50 51 |
# File 'lib/operationable/runners/base.rb', line 49 def job_sync_execute_method :perform_now end |
#persist? ⇒ Boolean
30 31 32 |
# File 'lib/operationable/runners/base.rb', line 30 def persist? true end |
#persist_operation ⇒ Object
22 23 24 |
# File 'lib/operationable/runners/base.rb', line 22 def persist_operation @persist_operation ||= ::Operationable::Persisters::Database.persist(check_callbacks, user.id, props, operation_class_name) end |
#run ⇒ Object
34 35 |
# File 'lib/operationable/runners/base.rb', line 34 def run end |
#store_callback(q_options) ⇒ Object
17 18 19 20 |
# File 'lib/operationable/runners/base.rb', line 17 def store_callback() op_cb = ::Operationable::Persisters::Database.create(, props) .merge({op_cb_id: op_cb.id}) end |