Class: Familia::Features::Relationships::ParticipationMembership
- Inherits:
-
Data
- Object
- Data
- Familia::Features::Relationships::ParticipationMembership
- Defined in:
- lib/familia/features/relationships/participation_membership.rb
Overview
This represents what currently exists in Redis, not just configuration. See ParticipationRelationship for static configuration metadata.
ParticipationMembership
Represents runtime snapshot of a participant's membership in a target collection. Returned by current_participations to provide a type-safe, structured view of actual participation state.
Instance Attribute Summary collapse
-
#collection_name ⇒ Object
readonly
Returns the value of attribute collection_name.
-
#decoded_score ⇒ Object
readonly
Returns the value of attribute decoded_score.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
-
#target_class ⇒ Object
readonly
Returns the value of attribute target_class.
-
#target_id ⇒ Object
readonly
Returns the value of attribute target_id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#list? ⇒ Boolean
Check if this membership is a list.
-
#set? ⇒ Boolean
Check if this membership is a set.
-
#sorted_set? ⇒ Boolean
Check if this membership is a sorted set.
-
#target_instance ⇒ Familia::Horreum?
Get the target instance (requires loading from database).
Instance Attribute Details
#collection_name ⇒ Object (readonly)
Returns the value of attribute collection_name
26 27 28 |
# File 'lib/familia/features/relationships/participation_membership.rb', line 26 def collection_name @collection_name end |
#decoded_score ⇒ Object (readonly)
Returns the value of attribute decoded_score
26 27 28 |
# File 'lib/familia/features/relationships/participation_membership.rb', line 26 def decoded_score @decoded_score end |
#position ⇒ Object (readonly)
Returns the value of attribute position
26 27 28 |
# File 'lib/familia/features/relationships/participation_membership.rb', line 26 def position @position end |
#score ⇒ Object (readonly)
Returns the value of attribute score
26 27 28 |
# File 'lib/familia/features/relationships/participation_membership.rb', line 26 def score @score end |
#target_class ⇒ Object (readonly)
Returns the value of attribute target_class
26 27 28 |
# File 'lib/familia/features/relationships/participation_membership.rb', line 26 def target_class @target_class end |
#target_id ⇒ Object (readonly)
Returns the value of attribute target_id
26 27 28 |
# File 'lib/familia/features/relationships/participation_membership.rb', line 26 def target_id @target_id end |
#type ⇒ Object (readonly)
Returns the value of attribute type
26 27 28 |
# File 'lib/familia/features/relationships/participation_membership.rb', line 26 def type @type end |
Instance Method Details
#list? ⇒ Boolean
Check if this membership is a list
49 50 51 |
# File 'lib/familia/features/relationships/participation_membership.rb', line 49 def list? type == :list end |
#set? ⇒ Boolean
Check if this membership is a set
43 44 45 |
# File 'lib/familia/features/relationships/participation_membership.rb', line 43 def set? type == :set end |
#sorted_set? ⇒ Boolean
Check if this membership is a sorted set
37 38 39 |
# File 'lib/familia/features/relationships/participation_membership.rb', line 37 def sorted_set? type == :sorted_set end |
#target_instance ⇒ Familia::Horreum?
Get the target instance (requires loading from database)
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/familia/features/relationships/participation_membership.rb', line 55 def target_instance return nil unless target_class # Resolve class from string name # Only rescue NameError (class doesn't exist), not all exceptions klass = Object.const_get(target_class) klass.find_by_id(target_id) rescue NameError # Target class doesn't exist or isn't loaded nil end |