Class: GCalendar
- Inherits:
-
Object
- Object
- GCalendar
- Defined in:
- lib/gcal.rb
Instance Attribute Summary collapse
-
#author_email ⇒ Object
Returns the value of attribute author_email.
-
#author_name ⇒ Object
Returns the value of attribute author_name.
-
#events ⇒ Object
Returns the value of attribute events.
-
#id ⇒ Object
Returns the value of attribute id.
-
#link ⇒ Object
Returns the value of attribute link.
-
#subtitle ⇒ Object
Returns the value of attribute subtitle.
-
#title ⇒ Object
Returns the value of attribute title.
-
#version ⇒ Object
Returns the value of attribute version.
-
#where ⇒ Object
Returns the value of attribute where.
Instance Method Summary collapse
- #<<(events) ⇒ Object
-
#initialize(hash = {}) ⇒ GCalendar
constructor
A new instance of GCalendar.
- #to_html ⇒ Object
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_email ⇒ Object
Returns the value of attribute author_email.
4 5 6 |
# File 'lib/gcal.rb', line 4 def @author_email end |
#author_name ⇒ Object
Returns the value of attribute author_name.
4 5 6 |
# File 'lib/gcal.rb', line 4 def @author_name end |
#events ⇒ Object
Returns the value of attribute events.
4 5 6 |
# File 'lib/gcal.rb', line 4 def events @events end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/gcal.rb', line 4 def id @id end |
#link ⇒ Object
Returns the value of attribute link.
4 5 6 |
# File 'lib/gcal.rb', line 4 def link @link end |
#subtitle ⇒ Object
Returns the value of attribute subtitle.
4 5 6 |
# File 'lib/gcal.rb', line 4 def subtitle @subtitle end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/gcal.rb', line 4 def title @title end |
#version ⇒ Object
Returns the value of attribute version.
4 5 6 |
# File 'lib/gcal.rb', line 4 def version @version end |
#where ⇒ Object
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_html ⇒ Object
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 |