Class: Hubba::Stats::HistoryItem
- Inherits:
-
Object
- Object
- Hubba::Stats::HistoryItem
- Defined in:
- lib/hubba/stats.rb
Overview
build history items (structs)
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
read-only attributes.
-
#next ⇒ Object
read/write attributes (for double linked list/nodes/items).
-
#prev ⇒ Object
read/write attributes (for double linked list/nodes/items).
-
#stars ⇒ Object
readonly
read-only attributes.
Instance Method Summary collapse
-
#append(item) ⇒ Object
link items (append item at the end/tail).
- #diff_days ⇒ Object
- #diff_stars ⇒ Object
-
#initialize(date:, stars:) ⇒ HistoryItem
constructor
A new instance of HistoryItem.
Constructor Details
#initialize(date:, stars:) ⇒ HistoryItem
Returns a new instance of HistoryItem.
56 57 58 59 |
# File 'lib/hubba/stats.rb', line 56 def initialize( date:, stars: ) @date = date @stars = stars end |
Instance Attribute Details
#date ⇒ Object (readonly)
read-only attributes
53 54 55 |
# File 'lib/hubba/stats.rb', line 53 def date @date end |
#next ⇒ Object
read/write attributes (for double linked list/nodes/items)
54 55 56 |
# File 'lib/hubba/stats.rb', line 54 def next @next end |
#prev ⇒ Object
read/write attributes (for double linked list/nodes/items)
54 55 56 |
# File 'lib/hubba/stats.rb', line 54 def prev @prev end |
#stars ⇒ Object (readonly)
read-only attributes
53 54 55 |
# File 'lib/hubba/stats.rb', line 53 def stars @stars end |
Instance Method Details
#append(item) ⇒ Object
link items (append item at the end/tail)
62 63 64 65 |
# File 'lib/hubba/stats.rb', line 62 def append( item ) @next = item item.prev = self end |
#diff_days ⇒ Object
67 68 69 70 71 72 73 74 |
# File 'lib/hubba/stats.rb', line 67 def diff_days if @next ## note: use jd=julian days for calculation @date.jd - @next.date.jd else nil ## last item (tail) end end |
#diff_stars ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/hubba/stats.rb', line 76 def diff_stars if @next @stars - @next.stars else nil ## last item (tail) end end |