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:



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

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

Instance Method Details

#displayedObject

:nodoc:



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

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

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

:nodoc:



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

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:



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

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

#nameObject

:nodoc:



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

def name #:nodoc:
  plist "Title"
end

#plist(key) ⇒ Object

:nodoc:



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

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