Class: CalendarAssistant::EventSet

Inherits:
Object
  • Object
show all
Defined in:
lib/calendar_assistant/event_set.rb

Overview

note that ‘events` could be a few different data structures, depending.

- it could be an Array of Events
- it could be a Hash, e.g. Date => Array of Events
- it could be a bare Event

Defined Under Namespace

Classes: Array, Bare, Base, Hash

Class Method Summary collapse

Class Method Details

.new(event_repository, events = nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/calendar_assistant/event_set.rb', line 10

def self.new(event_repository, events = nil)
  if events.is_a?(EventSet::Hash)
    return EventSet::Hash.new event_repository, events.try(:events)
  end
  if events.is_a?(::Hash)
    return EventSet::Hash.new event_repository, events
  end
  if events.is_a?(::Array)
    return EventSet::Array.new event_repository, events
  end
  return EventSet::Bare.new event_repository, events
end