summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLars Henrik Mai <lars.mai@kontinui.de>2014-09-21 18:17:24 +0200
committerLars Henrik Mai <lars.mai@kontinui.de>2014-09-21 18:17:24 +0200
commit1955959b3bbd997a6a7f585f0293a295c019c935 (patch)
tree042987d2cefea599f0213809b8afc3be18fbd792 /lib
parent28e38614ff6844680038aaba3e412f5183eb4bb5 (diff)
add EventList class
Diffstat (limited to 'lib')
-rw-r--r--lib/sublab_calendar.rb1
-rw-r--r--lib/sublab_calendar/event_list.rb19
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/sublab_calendar.rb b/lib/sublab_calendar.rb
index 66de90d..5595bc6 100644
--- a/lib/sublab_calendar.rb
+++ b/lib/sublab_calendar.rb
@@ -11,6 +11,7 @@ require 'json'
require 'sublab_calendar/calendar'
require 'sublab_calendar/event'
require 'sublab_calendar/occurrence'
+require 'sublab_calendar/event_list'
module SublabCalendar
diff --git a/lib/sublab_calendar/event_list.rb b/lib/sublab_calendar/event_list.rb
new file mode 100644
index 0000000..cc2d62b
--- /dev/null
+++ b/lib/sublab_calendar/event_list.rb
@@ -0,0 +1,19 @@
+require 'set'
+
+module SublabCalendar
+
+ class EventList
+
+ attr_reader :events
+
+ def initialize(events=[])
+ @events = SortedSet.new(events)
+ end
+
+ def to_json(*args)
+ events.map(&:to_json)
+ end
+
+ end
+
+end