Class: GCalendar

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ GCalendar

Returns a new instance of GCalendar.



6
7
8
9
# File 'lib/gcal.rb', line 6

def initialize(hash={})
  @events = []
  hash.each {|k,v| self.send("#{k}=",v)}
end

Instance Attribute Details

#author_emailObject

Returns the value of attribute author_email.



4
5
6
# File 'lib/gcal.rb', line 4

def author_email
  @author_email
end

#author_nameObject

Returns the value of attribute author_name.



4
5
6
# File 'lib/gcal.rb', line 4

def author_name
  @author_name
end

#eventsObject

Returns the value of attribute events.



4
5
6
# File 'lib/gcal.rb', line 4

def events
  @events
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/gcal.rb', line 4

def id
  @id
end

Returns the value of attribute link.



4
5
6
# File 'lib/gcal.rb', line 4

def link
  @link
end

#subtitleObject

Returns the value of attribute subtitle.



4
5
6
# File 'lib/gcal.rb', line 4

def subtitle
  @subtitle
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/gcal.rb', line 4

def title
  @title
end

#versionObject

Returns the value of attribute version.



4
5
6
# File 'lib/gcal.rb', line 4

def version
  @version
end

#whereObject

Returns the value of attribute where.



4
5
6
# File 'lib/gcal.rb', line 4

def where
  @where
end

Instance Method Details

#<<(events) ⇒ Object



11
12
13
# File 'lib/gcal.rb', line 11

def << (events)
  @events.concat events
end

#to_htmlObject



15
16
17
18
19
20
21
22
23
# File 'lib/gcal.rb', line 15

def to_html
  content = <<-EOF
    <div class="calendar" id="#{self.id}">
    <h1>#{self.title}</h1>
    <h2>#{self.subtitle}</h2>
    #{self.events.map {|x| x.to_html}}
    </div>
  EOF
end