Module: StockMarketDays::UtilityMethods

Included in:
Calculator
Defined in:
lib/stock_market_days/utility_methods.rb

Instance Method Summary collapse

Instance Method Details

#compare_time(time1, time2) ⇒ Object



12
13
14
# File 'lib/stock_market_days/utility_methods.rb', line 12

def compare_time(time1, time2)
  (time1.to_r / 86400) % 1 <=> (time2.to_r / 86400) % 1
end

#time_strip_date(time) ⇒ Object



4
5
6
# File 'lib/stock_market_days/utility_methods.rb', line 4

def time_strip_date(time)
  time.to_r / 86400 % 1
end

#time_strip_time_zone(time) ⇒ Object



8
9
10
# File 'lib/stock_market_days/utility_methods.rb', line 8

def time_strip_time_zone(time)
  Time.parse(time.strftime('%a, %d %b %Y %H:%M:%S'))
end