Class: Vpim::Repo::Ical3::Calendar

Inherits:
Object
  • Object
show all
Defined in:
lib/vpim/repo.rb

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ Calendar

:nodoc:



44
45
46
# File 'lib/vpim/repo.rb', line 44

def initialize(dir) # :nodoc:
  @dir = dir
end

Instance Method Details

#displayedObject

Whether a calendar should be displayed.



57
58
59
# File 'lib/vpim/repo.rb', line 57

def displayed
  1 == plist("Checked")
end

#eventsObject

Array of all events defined in the calendar.



62
63
64
65
66
# File 'lib/vpim/repo.rb', line 62

def events #:yield: Vevent
  Dir[ @dir + "/Events/*.ics" ].map do |ics|
    Repo.events_from_file(ics)
  end.flatten
end

#nameObject

The calendar name.



52
53
54
# File 'lib/vpim/repo.rb', line 52

def name
  plist "Title"
end

#plist(key) ⇒ Object

:nodoc:



47
48
49
# File 'lib/vpim/repo.rb', line 47

def plist(key) #:nodoc:
   Plist::parse_xml( @dir + "/Info.plist")[key]
end

#todosObject

Array of all todos defined in the calendar.



69
70
71
72
73
# File 'lib/vpim/repo.rb', line 69

def todos #:yield: Vevent
  Dir[ @dir + "/Events/*.ics" ].map do |ics|
    Repo.todos_from_file(ics)
  end.flatten
end