Class: Rerout::Models::StatsBreakdown
- Inherits:
-
Object
- Object
- Rerout::Models::StatsBreakdown
- Defined in:
- lib/rerout/models.rb
Overview
A breakdown bucket — ‘{ value: “ZA”, clicks: 42 }`.
Instance Attribute Summary collapse
-
#clicks ⇒ Object
readonly
Returns the value of attribute clicks.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(value:, clicks:) ⇒ StatsBreakdown
constructor
A new instance of StatsBreakdown.
- #to_h ⇒ Object
Constructor Details
#initialize(value:, clicks:) ⇒ StatsBreakdown
Returns a new instance of StatsBreakdown.
254 255 256 257 258 |
# File 'lib/rerout/models.rb', line 254 def initialize(value:, clicks:) @value = value @clicks = clicks freeze end |
Instance Attribute Details
#clicks ⇒ Object (readonly)
Returns the value of attribute clicks.
252 253 254 |
# File 'lib/rerout/models.rb', line 252 def clicks @clicks end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
252 253 254 |
# File 'lib/rerout/models.rb', line 252 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
260 261 262 |
# File 'lib/rerout/models.rb', line 260 def self.from_hash(hash) new(value: hash['value'], clicks: hash['clicks']) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
268 269 270 |
# File 'lib/rerout/models.rb', line 268 def ==(other) other.is_a?(StatsBreakdown) && other.value == value && other.clicks == clicks end |
#hash ⇒ Object
273 274 275 |
# File 'lib/rerout/models.rb', line 273 def hash [self.class, value, clicks].hash end |
#to_h ⇒ Object
264 265 266 |
# File 'lib/rerout/models.rb', line 264 def to_h { value: value, clicks: clicks } end |