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.
95 96 97 98 99 |
# File 'lib/rerout/models.rb', line 95 def initialize(value:, clicks:) @value = value @clicks = clicks freeze end |
Instance Attribute Details
#clicks ⇒ Object (readonly)
Returns the value of attribute clicks.
93 94 95 |
# File 'lib/rerout/models.rb', line 93 def clicks @clicks end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
93 94 95 |
# File 'lib/rerout/models.rb', line 93 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
101 102 103 |
# File 'lib/rerout/models.rb', line 101 def self.from_hash(hash) new(value: hash['value'], clicks: hash['clicks']) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
109 110 111 |
# File 'lib/rerout/models.rb', line 109 def ==(other) other.is_a?(StatsBreakdown) && other.value == value && other.clicks == clicks end |
#hash ⇒ Object
114 115 116 |
# File 'lib/rerout/models.rb', line 114 def hash [self.class, value, clicks].hash end |
#to_h ⇒ Object
105 106 107 |
# File 'lib/rerout/models.rb', line 105 def to_h { value: value, clicks: clicks } end |