From 1955959b3bbd997a6a7f585f0293a295c019c935 Mon Sep 17 00:00:00 2001 From: Lars Henrik Mai Date: Sun, 21 Sep 2014 18:17:24 +0200 Subject: add EventList class --- lib/sublab_calendar/event_list.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib/sublab_calendar/event_list.rb (limited to 'lib/sublab_calendar') 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 -- cgit v1.2.1