Class: Calendar

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

Overview

Remembers calendar meta data from xml configuration.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(calendar) ⇒ Calendar

Returns a new instance of Calendar.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/calendars.rb', line 3

def initialize(calendar)
	@regexp = false;
	@display = true;
	@forward = 0;
	if calendar["forward"] == "false"
		@display = false
	else
		@forward = calendar["forward"].to_i
	end
	@regexp = true if calendar["regexp"] == "true"
	@title = calendar["content"]
	if $DEBUG
		puts calendar.inspect
		puts "D: #{@display}, RE: #{@regexp}\n*******"
	end
end

Instance Attribute Details

#displayObject (readonly)

Returns the value of attribute display.



29
30
31
# File 'lib/calendars.rb', line 29

def display
  @display
end

#forwardObject (readonly)

Returns the value of attribute forward.



29
30
31
# File 'lib/calendars.rb', line 29

def forward
  @forward
end

Instance Method Details

#match?(title) ⇒ Boolean

Checks if title match this calendar.

Returns:

  • (Boolean)


21
22
23
24
25
26
27
# File 'lib/calendars.rb', line 21

def match?(title)
	if @regexp 
		return title =~ /#{@title}/
	else
		return title == @title
	end
end