Method: ICS::Event.file
- Defined in:
- lib/ics/event.rb
.file(file) ⇒ Object
Given an exported ical file, parse it and create events.
35 36 37 38 39 40 41 42 43 |
# File 'lib/ics/event.rb', line 35 def file(file) # format line endings. content = file.readlines.map(&:chomp).join($/) line_ending = $/ content.split("BEGIN:VEVENT#{line_ending}")[1..-1].map do |data_string| data_string = data_string.split("END:VEVENT#{line_ending}").first new parse(data_string) end end |