Module: Vpim::Repo

Defined in:
lib/vpim/repo.rb

Overview

A Repo is a representation of an event repository. Currently iCalv3 repositories and directories containing .ics files are supported.

TODO - should yield them if a block is given, or return an enumerable otherwise. Later.

Defined Under Namespace

Modules: Directory, Ical3

Class Method Summary collapse

Class Method Details

.events_from_file(file) ⇒ Object

:nodoc:



33
34
35
# File 'lib/vpim/repo.rb', line 33

def self.events_from_file(file) #:nodoc:
  self.somethings_from_file("events", file)
end

.somethings_from_file(something, file) ⇒ Object

:nodoc:



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/vpim/repo.rb', line 19

def self.somethings_from_file(something, file) #:nodoc:
  somethings = []
  begin
    cals = Vpim::Icalendar.decode(File.open(file))

    cals.each do |cal|
      cal.send(something).each do |x|
        somethings << x
      end
    end
  end
  somethings
end

.todos_from_file(file) ⇒ Object

:nodoc:



37
38
39
# File 'lib/vpim/repo.rb', line 37

def self.todos_from_file(file) #:nodoc:
  self.somethings_from_file("todos", file)
end