Class: GeoLabels::RatingObject
- Inherits:
-
Object
- Object
- GeoLabels::RatingObject
- Defined in:
- app/models/concerns/geo_labels/ratings_support.rb
Overview
Represent the rating of one topic as an object
Instance Attribute Summary collapse
-
#record ⇒ Object
readonly
Returns the value of attribute record.
-
#topic ⇒ Object
readonly
Returns the value of attribute topic.
Instance Method Summary collapse
-
#initialize(record, topic) ⇒ RatingObject
constructor
A new instance of RatingObject.
- #value ⇒ Object
- #value=(value) ⇒ Object
Constructor Details
#initialize(record, topic) ⇒ RatingObject
Returns a new instance of RatingObject.
10 11 12 |
# File 'app/models/concerns/geo_labels/ratings_support.rb', line 10 def initialize(record, topic) @record, @topic = record, topic end |
Instance Attribute Details
#record ⇒ Object (readonly)
Returns the value of attribute record.
8 9 10 |
# File 'app/models/concerns/geo_labels/ratings_support.rb', line 8 def record @record end |
#topic ⇒ Object (readonly)
Returns the value of attribute topic.
8 9 10 |
# File 'app/models/concerns/geo_labels/ratings_support.rb', line 8 def topic @topic end |
Instance Method Details
#value ⇒ Object
14 15 16 17 |
# File 'app/models/concerns/geo_labels/ratings_support.rb', line 14 def value # expect active_record column attribute record.public_send("#{topic}_rating") end |
#value=(value) ⇒ Object
19 20 21 |
# File 'app/models/concerns/geo_labels/ratings_support.rb', line 19 def value=(value) record.public_send("#{topic}_rating=", value) end |