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.
61 62 63 64 65 |
# File 'lib/rerout/models.rb', line 61 def initialize(value:, clicks:) @value = value @clicks = clicks freeze end |
Instance Attribute Details
#clicks ⇒ Object (readonly)
Returns the value of attribute clicks.
59 60 61 |
# File 'lib/rerout/models.rb', line 59 def clicks @clicks end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
59 60 61 |
# File 'lib/rerout/models.rb', line 59 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
67 68 69 |
# File 'lib/rerout/models.rb', line 67 def self.from_hash(hash) new(value: hash['value'], clicks: hash['clicks']) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
75 76 77 |
# File 'lib/rerout/models.rb', line 75 def ==(other) other.is_a?(StatsBreakdown) && other.value == value && other.clicks == clicks end |
#hash ⇒ Object
80 81 82 |
# File 'lib/rerout/models.rb', line 80 def hash [self.class, value, clicks].hash end |
#to_h ⇒ Object
71 72 73 |
# File 'lib/rerout/models.rb', line 71 def to_h { value: value, clicks: clicks } end |