Class: TQ::QueueSpec
- Inherits:
-
Object
- Object
- TQ::QueueSpec
- Defined in:
- lib/tq.rb
Instance Attribute Summary collapse
-
#lease_duration ⇒ Object
readonly
Returns the value of attribute lease_duration.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#max_tasks ⇒ Object
readonly
Returns the value of attribute max_tasks.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(project, location, name, lease_duration: '60s', max_tasks: 1) ⇒ QueueSpec
constructor
A new instance of QueueSpec.
- #queue_name ⇒ Object
Constructor Details
#initialize(project, location, name, lease_duration: '60s', max_tasks: 1) ⇒ QueueSpec
Returns a new instance of QueueSpec.
101 102 103 104 105 106 107 108 |
# File 'lib/tq.rb', line 101 def initialize(project, location, name, lease_duration: '60s', max_tasks: 1) @project = project @location = location @name = name @lease_duration = lease_duration @max_tasks = max_tasks end |
Instance Attribute Details
#lease_duration ⇒ Object (readonly)
Returns the value of attribute lease_duration.
100 101 102 |
# File 'lib/tq.rb', line 100 def lease_duration @lease_duration end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
100 101 102 |
# File 'lib/tq.rb', line 100 def location @location end |
#max_tasks ⇒ Object (readonly)
Returns the value of attribute max_tasks.
100 101 102 |
# File 'lib/tq.rb', line 100 def max_tasks @max_tasks end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
100 101 102 |
# File 'lib/tq.rb', line 100 def name @name end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
100 101 102 |
# File 'lib/tq.rb', line 100 def project @project end |
Class Method Details
.from_hash(data) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/tq.rb', line 88 def self.from_hash(data) return new( data['project'], data['location'], data['name'], **( { lease_duration: data['lease_duration'], max_tasks: data['max_tasks'] }.reject {|k,v| v.nil?} ) ) end |
Instance Method Details
#queue_name ⇒ Object
110 111 112 |
# File 'lib/tq.rb', line 110 def queue_name "projects/#{project}/locations/#{location}/queues/#{name}" end |