class Postjob::Registry::WorkflowSpec::Options

Constants

DEFAULTS

Attributes

cron_interval[R]
greedy[R]
max_attempts[R]
queue[R]
sticky[R]
timeout[R]
version[R]

Public Class Methods

new(options) click to toggle source
# File lib/postjob/registry.rb, line 85
def initialize(options)
  expect! options => {
    version:        [ nil, /^\d+(\.\d+)*/ ],
    max_attempts:   [ nil, Integer ],
    timeout:        [ nil, Integer ],
    sticky:         [ nil, true, false ],
    cron_interval:  [ nil, Integer ],
    queue:          [ nil, String ]
  }

  options = DEFAULTS.merge(options)

  options[:sticky] ||= options[:greedy]

  @version        = options[:version]
  @max_attempts   = options[:max_attempts]
  @timeout        = options[:timeout]
  @sticky         = options[:sticky]
  @greedy         = options[:greedy]
  @cron_interval  = options[:cron_interval]
  @queue          = options[:queue]
end

Public Instance Methods

inspect() click to toggle source
# File lib/postjob/registry.rb, line 108
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