Class: AhlScraper::IceTimeHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/ahl_scraper/helpers/ice_time_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(time) ⇒ IceTimeHelper

Returns a new instance of IceTimeHelper.



7
8
9
# File 'lib/ahl_scraper/helpers/ice_time_helper.rb', line 7

def initialize(time)
  @time = time
end

Instance Attribute Details

#timeObject (readonly)

Returns the value of attribute time.



5
6
7
# File 'lib/ahl_scraper/helpers/ice_time_helper.rb', line 5

def time
  @time
end

Instance Method Details

#to_secondsObject Also known as: to_sec



11
12
13
14
15
16
# File 'lib/ahl_scraper/helpers/ice_time_helper.rb', line 11

def to_seconds
  return unless time

  ice_time = time&.split(":")
  ice_time[0].to_i * 60 + ice_time[1].to_i
end