Class: CEML::IncidentRoleSlot

Inherits:
Struct
  • Object
show all
Includes:
Redis::Objects
Defined in:
lib/ceml/models/incident_role_slot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#incident_idObject

Returns the value of attribute incident_id

Returns:

  • (Object)

    the current value of incident_id



3
4
5
# File 'lib/ceml/models/incident_role_slot.rb', line 3

def incident_id
  @incident_id
end

#maxObject

Returns the value of attribute max

Returns:

  • (Object)

    the current value of max



3
4
5
# File 'lib/ceml/models/incident_role_slot.rb', line 3

def max
  @max
end

#roleObject

Returns the value of attribute role

Returns:

  • (Object)

    the current value of role



3
4
5
# File 'lib/ceml/models/incident_role_slot.rb', line 3

def role
  @role
end

Instance Method Details

#full?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/ceml/models/incident_role_slot.rb', line 12

def full?
  casted.value >= max
end

#idObject



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