Class: CEML::IncidentRoleSlot
- Inherits:
-
Struct
- Object
- Struct
- CEML::IncidentRoleSlot
- Includes:
- Redis::Objects
- Defined in:
- lib/ceml/models/incident_role_slot.rb
Instance Attribute Summary collapse
-
#incident_id ⇒ Object
Returns the value of attribute incident_id.
-
#max ⇒ Object
Returns the value of attribute max.
-
#role ⇒ Object
Returns the value of attribute role.
Instance Method Summary collapse
Instance Attribute Details
#incident_id ⇒ Object
Returns the value of attribute incident_id
3 4 5 |
# File 'lib/ceml/models/incident_role_slot.rb', line 3 def incident_id @incident_id end |
#max ⇒ Object
Returns the value of attribute max
3 4 5 |
# File 'lib/ceml/models/incident_role_slot.rb', line 3 def max @max end |
#role ⇒ Object
Returns the value of attribute role
3 4 5 |
# File 'lib/ceml/models/incident_role_slot.rb', line 3 def role @role end |
Instance Method Details
#full? ⇒ Boolean
12 13 14 |
# File 'lib/ceml/models/incident_role_slot.rb', line 12 def full? casted.value >= max end |
#id ⇒ Object
4 |
# File 'lib/ceml/models/incident_role_slot.rb', line 4 def id; "#{incident_id}:#{role}"; end |
#reserve_spot! ⇒ Object
8 9 10 |
# File 'lib/ceml/models/incident_role_slot.rb', line 8 def reserve_spot! casted.incr{ |val| val <= max } end |