Class: Sidekiq::Control::Worker::Param

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq/control/worker/param.rb

Constant Summary collapse

TYPE_MAP =
{ req: 'required', opt: 'optional' }.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, name = nil) ⇒ Param

Returns a new instance of Param.



13
14
15
16
# File 'lib/sidekiq/control/worker/param.rb', line 13

def initialize(type, name=nil)
  @type = type
  @name = name.to_s
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/sidekiq/control/worker/param.rb', line 10

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



9
10
11
# File 'lib/sidekiq/control/worker/param.rb', line 9

def type
  @type
end

#valueObject

Returns the value of attribute value.



11
12
13
# File 'lib/sidekiq/control/worker/param.rb', line 11

def value
  @value
end

Instance Method Details

#optional?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/sidekiq/control/worker/param.rb', line 32

def optional?
  !required?
end

#required?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/sidekiq/control/worker/param.rb', line 28

def required?
  @type == :req
end

#type_nameObject



24
25
26
# File 'lib/sidekiq/control/worker/param.rb', line 24

def type_name
  TYPE_MAP[@type]
end