Class: Vpim::Repo::Apple3::Calendar

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

Instance Method Summary collapse

Methods inherited from Calendar

#events, #file_each, #todos

Constructor Details

#initialize(dir) ⇒ Calendar

:nodoc:



113
114
115
# File 'lib/vpim/repo.rb', line 113

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

Instance Method Details

#displayedObject

:nodoc:



125
126
127
# File 'lib/vpim/repo.rb', line 125

def displayed #:nodoc:
  1 == plist("Checked")
end

#each(klass = nil, &block) ⇒ Object

:nodoc:



129
130
131
132
133
134
135
136
137
# File 'lib/vpim/repo.rb', line 129

def each(klass=nil, &block) #:nodoc:
  unless iterator?
    return Enumerable::Enumerator.new(self, :each, klass)
  end
  Dir[ @dir + "/Events/*.ics" ].map do |ics|
    file_each(ics, klass, &block)
  end
  self
end

#encodeObject

:nodoc:



139
140
141
142
143
# File 'lib/vpim/repo.rb', line 139

def encode #:nodoc:
  Icalendar.create2 do |cal|
    each{|c| cal << c}
  end.encode
end

#nameObject

:nodoc:



121
122
123
# File 'lib/vpim/repo.rb', line 121

def name #:nodoc:
  plist "Title"
end

#plist(key) ⇒ Object

:nodoc:



117
118
119
# File 'lib/vpim/repo.rb', line 117

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