Class: Sidekiq::Control::Worker::Param
- Inherits:
-
Object
- Object
- Sidekiq::Control::Worker::Param
- Defined in:
- lib/sidekiq/control/worker/param.rb
Constant Summary collapse
- TYPE_MAP =
{ req: 'required', opt: 'optional' }.freeze
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(type, name = nil) ⇒ Param
constructor
A new instance of Param.
- #optional? ⇒ Boolean
- #required? ⇒ Boolean
- #type_name ⇒ Object
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
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/sidekiq/control/worker/param.rb', line 10 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/sidekiq/control/worker/param.rb', line 9 def type @type end |
#value ⇒ Object
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
32 33 34 |
# File 'lib/sidekiq/control/worker/param.rb', line 32 def optional? !required? end |
#required? ⇒ Boolean
28 29 30 |
# File 'lib/sidekiq/control/worker/param.rb', line 28 def required? @type == :req end |
#type_name ⇒ Object
24 25 26 |
# File 'lib/sidekiq/control/worker/param.rb', line 24 def type_name TYPE_MAP[@type] end |