Module: ChaoticJob::Helpers
- Defined in:
- lib/chaotic_job.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #glitch_before_call(key) ⇒ Object
- #glitch_before_line(key, &block) ⇒ Object
- #glitch_before_return(key, return_type = nil, &block) ⇒ Object
- #perform_all_jobs ⇒ Object
- #perform_all_jobs_after(time) ⇒ Object
- #perform_all_jobs_before(time) ⇒ Object (also: #perform_all_jobs_within)
- #run_scenario(job, glitch:, raise: nil, capture: nil, &block) ⇒ Object
Class Method Details
.included(base) ⇒ Object
83 84 85 |
# File 'lib/chaotic_job.rb', line 83 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#glitch_before_call(key) ⇒ Object
130 131 132 |
# File 'lib/chaotic_job.rb', line 130 def glitch_before_call(key, ...) Glitch.before_call(key, ...) end |
#glitch_before_line(key, &block) ⇒ Object
126 127 128 |
# File 'lib/chaotic_job.rb', line 126 def glitch_before_line(key, &block) Glitch.before_line(key, &block) end |
#glitch_before_return(key, return_type = nil, &block) ⇒ Object
134 135 136 |
# File 'lib/chaotic_job.rb', line 134 def glitch_before_return(key, return_type = nil, &block) Glitch.before_return(key, return_type, &block) end |
#perform_all_jobs ⇒ Object
99 100 101 |
# File 'lib/chaotic_job.rb', line 99 def perform_all_jobs Performer.perform_all end |
#perform_all_jobs_after(time) ⇒ Object
108 109 110 |
# File 'lib/chaotic_job.rb', line 108 def perform_all_jobs_after(time) Performer.perform_all_after(time) end |
#perform_all_jobs_before(time) ⇒ Object Also known as: perform_all_jobs_within
103 104 105 |
# File 'lib/chaotic_job.rb', line 103 def perform_all_jobs_before(time) Performer.perform_all_before(time) end |
#run_scenario(job, glitch:, raise: nil, capture: nil, &block) ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/chaotic_job.rb', line 112 def run_scenario(job, glitch:, raise: nil, capture: nil, &block) kwargs = {} kwargs[:glitch] = glitch kwargs[:raise] = binding.local_variable_get(:raise) if binding.local_variable_get(:raise) kwargs[:capture] = capture if capture if block Scenario.new(job, **kwargs).run(&block) else Scenario.new(job, **kwargs).run end end |