Class: Calendars

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

Overview

Container for calendars read from configuration.

Instance Method Summary collapse

Constructor Details

#initialize(calendars) ⇒ Calendars



34
35
36
37
38
39
40
# File 'lib/calendars.rb', line 34

def initialize(calendars)
  @calendars = [];
  return if calendars.nil?
  calendars["title"].each { |cal|
    @calendars << Calendar.new(cal)
  }
end

Instance Method Details

#display?(title) ⇒ Boolean

Checks if any calendar match title.



43
44
45
46
47
48
49
# File 'lib/calendars.rb', line 43

def display?(title)
  cal = @calendars.find { |cal|
    cal.match?(title)
  }
  return cal.display unless cal.nil?
  return true;
end

#forward(title) ⇒ Object

Returns how many days in the future calendar should be chcecked.



52
53
54
55
56
57
58
# File 'lib/calendars.rb', line 52

def forward(title)
  cal = @calendars.find { |cal|
    cal.match?(title)
  }
  return cal.forward unless cal.nil?
  return 0;
end