Module: CAL

Defined in:
lib/remind/calendar.rb

Overview

Icalendar wrapper.

Allows injection of ics calender events from either a remote server or file. Meant to provide the backbone event source for local reminders.

Defined Under Namespace

Classes: C, E

Class Method Summary collapse

Class Method Details

.from_file(f) ⇒ Object

Load Calendar Event Collection from file f.



51
52
53
54
# File 'lib/remind/calendar.rb', line 51

def self.from_file f
  x = File.read(f)
  C.new(Icalendar::Calendar.parse(x).first)
end

.from_url(u) ⇒ Object

Load Calendar Event Collection from url u.



56
57
58
59
# File 'lib/remind/calendar.rb', line 56

def self.from_url u
  x = Faraday.new().get(u).body
  C.new(Icalendar::Calendar.parse(x).first)
end