class Claymore::TotalHashRate

Extracts total hash rate with asset symbol

Example input: 05:45:16:028 2100 ETH - Total Speed: 90.118 Mh/s, Total Shares: 237, Rejected: 0, Time: 06:50

Example output: { 'asset' => 'ETH', 'hash_rate' => 90.118, 'type' => 'TOTAL_HASH_RATE' }

Constants

LINE_REGEXP
TOTAL_RATE_REGEXP

Attributes

line[R]

Public Class Methods

call(line) click to toggle source
# File lib/claymore/total_hash_rate.rb, line 17
def self.call(line)
  new(line).call
end
new(line) click to toggle source
# File lib/claymore/total_hash_rate.rb, line 23
def initialize(line)
  @line = line
end

Public Instance Methods

call() click to toggle source
# File lib/claymore/total_hash_rate.rb, line 27
def call
  (match = LINE_REGEXP.match(line)) || return

  {
    'asset' => match[:asset],
    'hash_rate' => match[:rate].to_f.round(3),
    'type' => 'TOTAL_HASH_RATE'
  }
end