Class: RailsAsyncMethods::ActiveJobOptionsParser
- Defined in:
- lib/rails_async_methods/active_job_options_parser.rb
Constant Summary collapse
- SET_OPTIONS =
%i[queue wait_until wait priority].freeze
- STRING_ARG_SEPERATOR =
[':', ','].freeze
Instance Attribute Summary collapse
-
#job ⇒ Object
readonly
Returns the value of attribute job.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
-
#priority ⇒ Object
readonly
Returns the value of attribute priority.
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
-
#wait ⇒ Object
readonly
Returns the value of attribute wait.
-
#wait_until ⇒ Object
readonly
Returns the value of attribute wait_until.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ ActiveJobOptionsParser
constructor
A new instance of ActiveJobOptionsParser.
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ ActiveJobOptionsParser
Returns a new instance of ActiveJobOptionsParser.
8 9 10 11 12 13 14 15 |
# File 'lib/rails_async_methods/active_job_options_parser.rb', line 8 def initialize(opts={}) @prefix = method_prefix(opts[:prefix]) @queue = opts[:queue] @wait_until = opts[:wait_until].to_f if opts[:wait_until] @wait = opts[:wait].seconds.to_f if opts[:wait] @priority = opts[:priority].to_i if opts[:priority] @job = get_job_obj(opts[:job]) end |
Instance Attribute Details
#job ⇒ Object (readonly)
Returns the value of attribute job.
5 6 7 |
# File 'lib/rails_async_methods/active_job_options_parser.rb', line 5 def job @job end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
5 6 7 |
# File 'lib/rails_async_methods/active_job_options_parser.rb', line 5 def prefix @prefix end |
#priority ⇒ Object (readonly)
Returns the value of attribute priority.
5 6 7 |
# File 'lib/rails_async_methods/active_job_options_parser.rb', line 5 def priority @priority end |
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
5 6 7 |
# File 'lib/rails_async_methods/active_job_options_parser.rb', line 5 def queue @queue end |
#wait ⇒ Object (readonly)
Returns the value of attribute wait.
5 6 7 |
# File 'lib/rails_async_methods/active_job_options_parser.rb', line 5 def wait @wait end |
#wait_until ⇒ Object (readonly)
Returns the value of attribute wait_until.
5 6 7 |
# File 'lib/rails_async_methods/active_job_options_parser.rb', line 5 def wait_until @wait_until end |
Instance Method Details
#to_h ⇒ Object
17 18 19 |
# File 'lib/rails_async_methods/active_job_options_parser.rb', line 17 def to_h valid_instance_values end |
#to_s ⇒ Object
21 22 23 24 25 |
# File 'lib/rails_async_methods/active_job_options_parser.rb', line 21 def to_s return '' if valid_instance_values.empty? valid_instance_values.to_s end |