Sha256: 84abeccfc003a127a0adaf24efe3a3333e5c20f9fe090e6ddbc5958fc55418f7

Contents?: true

Size: 411 Bytes

Versions: 2

Compression:

Stored size: 411 Bytes

Contents

class Time
  def beginning_of_weekend
    friday = case self.wday
    when 0
      self.end_of_week.beginning_of_day.advance(:days => -2) 
    when 5
      self.beginning_of_day
    else
      self.beginning_of_week.advance(:days => 4)
    end
    # 3pm, Friday.
    (friday + 15.hours)
  end

  def end_of_weekend
    # 3am, Monday.
    # LOL I CHEATED.
    beginning_of_weekend + 3.days - 12.hours
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
by_star-2.1.0.beta2 lib/by_star/time_ext.rb
by_star-2.0.0.beta1 lib/by_star/time_ext.rb