Sha256: 11faa4de60dcdc2244e0bc5413035fb7e083e21902dd08ebc90c28eb813cf9e9

Contents?: true

Size: 409 Bytes

Versions: 8

Compression:

Stored size: 409 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

8 entries across 8 versions & 1 rubygems

Version Path
by_star-1.0.1 lib/by_star/time_ext.rb
by_star-1.0.0 lib/by_star/time_ext.rb
by_star-0.9.0 lib/time_ext.rb
by_star-0.8.0 lib/time_ext.rb
by_star-0.7.2 lib/time_ext.rb
by_star-0.7.1 lib/time_ext.rb
by_star-0.7.0 lib/time_ext.rb
by_star-0.6.4 lib/time_ext.rb