class TwentyOneDayChallenge::Countdown
Attributes
current_day[R]
time_left[R]
Public Class Methods
new()
click to toggle source
# File lib/21-day-challenge-countdown.rb, line 11 def initialize() Time.zone = "UTC" start = ActiveSupport::TimeZone.new("Mountain Time (US & Canada)").parse("13/04/2015 12:00").to_datetime now = Time.zone.now.to_datetime elapsed = (now-start) @current_day = (elapsed).ceil next_deadline = start+@current_day left_today = next_deadline.to_time-now.to_time @time_left = Time.zone.at(left_today) #left_string = @time_left.strftime("%H:%M:%S") end
Public Instance Methods
deadline()
click to toggle source
# File lib/21-day-challenge-countdown.rb, line 23 def deadline() #enter your local time zone here! return "Today is day #{self.current_day}. You have #{self.time_left.strftime("%H:%M:%S")} left to send your pull request." end