Module: Bp3::Noticed::JobIncludes
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/bp3/noticed/job_includes.rb
Instance Method Summary collapse
- #check(hash_or_array, key) ⇒ Object private
- #enqueue ⇒ Object
- #job_key ⇒ Object private
- #job_type ⇒ Object private
- #run_attrs(key) ⇒ Object private
- #site ⇒ Object private
Instance Method Details
#check(hash_or_array, key) ⇒ Object (private)
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/bp3/noticed/job_includes.rb', line 43 def check(hash_or_array, key) return nil if hash_or_array.blank? if hash_or_array.is_a?(Array) hash_or_array.each do |obj| value = check(obj, key) return value if value end nil elsif hash_or_array.is_a?(Hash) hash_or_array[key.to_s] || hash_or_array[key.to_sym] end end |
#enqueue ⇒ Object
26 27 28 29 30 31 |
# File 'lib/bp3/noticed/job_includes.rb', line 26 def enqueue(*, **) # Add state to arguments, not kwargs # kwargs['state'] = GlobalRequestState.to_hash arguments << { 'state' => global_request_state_class.to_hash } super end |
#job_key ⇒ Object (private)
61 62 63 |
# File 'lib/bp3/noticed/job_includes.rb', line 61 def job_key self.class.name.underscore end |
#job_type ⇒ Object (private)
35 36 37 |
# File 'lib/bp3/noticed/job_includes.rb', line 35 def job_type 'job' end |
#run_attrs(key) ⇒ Object (private)
39 40 41 |
# File 'lib/bp3/noticed/job_includes.rb', line 39 def run_attrs(key) check(arguments, key) end |
#site ⇒ Object (private)
57 58 59 |
# File 'lib/bp3/noticed/job_includes.rb', line 57 def site global_request_state_class.current_site end |