Sha256: 375eac638185bdb81adc58c0fd7b3293de0621e7fffcd89f25bbe989fb22f56a

Contents?: true

Size: 597 Bytes

Versions: 4

Compression:

Stored size: 597 Bytes

Contents

class Array
  def to_ics
    to_rical.to_s
  end
  
  def to_rical
    RiCal.Calendar do |cal|
      self.flatten.each do |item|
        cal.add_subcomponent(item.to_rical) if item.respond_to?(:to_rical)
      end
    end
  end
end

class Time
  def ceil(seconds = 60)
    Time.at((self.to_f / seconds).ceil * seconds)
  end

  def floor(seconds = 60)
    Time.at((self.to_f / seconds).floor * seconds)
  end
end

class DateTime
  def ceil(seconds = 60)
    Time.at(self.to_f).ceil(seconds).to_datetime
  end

  def floor(seconds = 60)
    Time.at(self.to_f).floor(seconds).to_datetime
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
droom-0.4.3 lib/droom/monkeys.rb
droom-0.4.2 lib/droom/monkeys.rb
droom-0.4.1 lib/droom/monkeys.rb
droom-0.2.1 lib/droom/monkeys.rb