Class: Postjob::Registry::WorkflowSpec::Options
- Inherits:
-
Object
- Object
- Postjob::Registry::WorkflowSpec::Options
- Defined in:
- lib/postjob/registry.rb
Constant Summary collapse
- DEFAULTS =
{ version: "0.0", max_attempts: 5, timeout: 15 * 60, sticky: false, greedy: false, cron_interval: nil, queue: Postjob::DEFAULT_QUEUE }
Instance Attribute Summary collapse
-
#cron_interval ⇒ Object
readonly
Returns the value of attribute cron_interval.
-
#greedy ⇒ Object
readonly
Returns the value of attribute greedy.
-
#max_attempts ⇒ Object
readonly
Returns the value of attribute max_attempts.
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
-
#sticky ⇒ Object
readonly
Returns the value of attribute sticky.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(options) ⇒ Options
constructor
A new instance of Options.
- #inspect ⇒ Object
Constructor Details
#initialize(options) ⇒ Options
Returns a new instance of Options.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/postjob/registry.rb', line 73 def initialize() expect! => { version: [ nil, /^\d+(\.\d+)*/ ], max_attempts: [ nil, Integer ], timeout: [ nil, Integer ], sticky: [ nil, true, false ], cron_interval: [ nil, Integer ], queue: [ nil, String ] } = DEFAULTS.merge() [:sticky] ||= [:greedy] @version = [:version] @max_attempts = [:max_attempts] @timeout = [:timeout] @sticky = [:sticky] @greedy = [:greedy] @cron_interval = [:cron_interval] @queue = [:queue] end |
Instance Attribute Details
#cron_interval ⇒ Object (readonly)
Returns the value of attribute cron_interval.
70 71 72 |
# File 'lib/postjob/registry.rb', line 70 def cron_interval @cron_interval end |
#greedy ⇒ Object (readonly)
Returns the value of attribute greedy.
69 70 71 |
# File 'lib/postjob/registry.rb', line 69 def greedy @greedy end |
#max_attempts ⇒ Object (readonly)
Returns the value of attribute max_attempts.
66 67 68 |
# File 'lib/postjob/registry.rb', line 66 def max_attempts @max_attempts end |
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
71 72 73 |
# File 'lib/postjob/registry.rb', line 71 def queue @queue end |
#sticky ⇒ Object (readonly)
Returns the value of attribute sticky.
68 69 70 |
# File 'lib/postjob/registry.rb', line 68 def sticky @sticky end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
67 68 69 |
# File 'lib/postjob/registry.rb', line 67 def timeout @timeout end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
65 66 67 |
# File 'lib/postjob/registry.rb', line 65 def version @version end |
Instance Method Details
#inspect ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/postjob/registry.rb', line 96 def inspect r = {} r[:version] = @version r[:max_attempts] = @max_attempts r[:timeout] = @timeout r[:sticky] = @sticky r[:greedy] = @greedy r[:cron_interval] = @cron_interval r[:queue] = @queue m = [] r.each do |k, v| next if DEFAULTS[k] == v m << "#{k}: #{v.inspect}" end m.join(", ") end |