Class: Ical2gcal::Ics::Events
- Inherits:
-
Object
- Object
- Ical2gcal::Ics::Events
- Defined in:
- lib/ics/events.rb
Instance Method Summary collapse
- #calendars ⇒ Object
- #each(&block) ⇒ Object
- #get ⇒ Object
-
#initialize(uri) ⇒ Events
constructor
A new instance of Events.
Constructor Details
#initialize(uri) ⇒ Events
Returns a new instance of Events.
12 13 14 15 |
# File 'lib/ics/events.rb', line 12 def initialize( uri ) @uri = uri @calendars = nil end |
Instance Method Details
#calendars ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/ics/events.rb', line 17 def calendars if ( @uri and !@calendars ) @calendars = RiCal.parse( open( @uri ) ) end @calendars end |
#each(&block) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/ics/events.rb', line 29 def each( &block ) calendars.each { |c| c.events.each { |e| block.call( e ) } } end |
#get ⇒ Object
25 26 27 |
# File 'lib/ics/events.rb', line 25 def get calendars.map { |c| c.events }.flatten end |