Sha256: 207183aff977550c423cb17789dc99336982f369fb6621cfdafdc03b11ecf811
Contents?: true
Size: 601 Bytes
Versions: 1
Compression:
Stored size: 601 Bytes
Contents
require 'time' class Timespan attr_accessor :start attr_accessor :finish def initialize start, finish @start = start @finish = finish end def spans? date @start <= date && @finish >= date end def self.from_day date start = DateTime.new date.year, date.month, date.day, 0, 0 finish = DateTime.new date.year, date.month, date.day, 23, 59 Timsepan.new start, finish end # Return Timespan from start to end of start (day). def self.day_end start finish = DateTime.new start.year, start.month, start.day, 23, 59 Timespan.new start, finish end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kalindar-0.3.0 | lib/kalindar/timespan.rb |