Class: CalendarAssistant::EventSet::Base

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

Direct Known Subclasses

Array, Bare, Hash

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_repository, events) ⇒ Base

Returns a new instance of Base.



26
27
28
29
# File 'lib/calendar_assistant/event_set.rb', line 26

def initialize(event_repository, events)
  @event_repository = event_repository
  @events = events
end

Instance Attribute Details

#event_repositoryObject (readonly)

Returns the value of attribute event_repository.



24
25
26
# File 'lib/calendar_assistant/event_set.rb', line 24

def event_repository
  @event_repository
end

#eventsObject (readonly)

Returns the value of attribute events.



24
25
26
# File 'lib/calendar_assistant/event_set.rb', line 24

def events
  @events
end

Instance Method Details

#==(rhs) ⇒ Object



31
32
33
34
# File 'lib/calendar_assistant/event_set.rb', line 31

def ==(rhs)
  return false unless rhs.is_a?(self.class)
  self.event_repository == rhs.event_repository && self.events == rhs.events
end

#empty?Boolean

Returns:

  • (Boolean)


40
41
42
43
44
# File 'lib/calendar_assistant/event_set.rb', line 40

def empty?
  return true if events.nil?
  return events.length == 0 if events.is_a?(Enumerable)
  false
end

#new(new_events) ⇒ Object



36
37
38
# File 'lib/calendar_assistant/event_set.rb', line 36

def new(new_events)
  EventSet.new self.event_repository, new_events
end