Class: WaffleAPI::Worker
- Inherits:
-
Object
- Object
- WaffleAPI::Worker
- Defined in:
- lib/waffle_api/worker.rb
Overview
Worker object give access to it's hashrate, stalerate, etc...
Instance Attribute Summary collapse
-
#hash_rate ⇒ Object
readonly
Returns the value of attribute hash_rate.
-
#last_seen ⇒ Object
readonly
Returns the value of attribute last_seen.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#stale_rate ⇒ Object
readonly
Returns the value of attribute stale_rate.
Instance Method Summary collapse
-
#initialize(name: '', hash_rate: 0, stale_rate: 0.0, last_seen: 0) ⇒ Worker
constructor
A new instance of Worker.
Constructor Details
#initialize(name: '', hash_rate: 0, stale_rate: 0.0, last_seen: 0) ⇒ Worker
Returns a new instance of Worker.
6 7 8 9 10 11 12 |
# File 'lib/waffle_api/worker.rb', line 6 def initialize(name: '', hash_rate: 0, stale_rate: 0.0, last_seen: 0) @name = name.split('_', 2).last @name = name if @name.nil? || @name.empty? @hash_rate = hash_rate @stale_rate = stale_rate @last_seen = Time.at(last_seen) end |
Instance Attribute Details
#hash_rate ⇒ Object (readonly)
Returns the value of attribute hash_rate.
4 5 6 |
# File 'lib/waffle_api/worker.rb', line 4 def hash_rate @hash_rate end |
#last_seen ⇒ Object (readonly)
Returns the value of attribute last_seen.
4 5 6 |
# File 'lib/waffle_api/worker.rb', line 4 def last_seen @last_seen end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/waffle_api/worker.rb', line 4 def name @name end |
#stale_rate ⇒ Object (readonly)
Returns the value of attribute stale_rate.
4 5 6 |
# File 'lib/waffle_api/worker.rb', line 4 def stale_rate @stale_rate end |