Sha256: d8b60e273c7d84144549e7805318e2c81ed0475d9d718eb5e221a47b044de318

Contents?: true

Size: 1.48 KB

Versions: 4

Compression:

Stored size: 1.48 KB

Contents

=begin
  Copyright (C) 2005 Jeff Rose

  This library is free software; you can redistribute it and/or modify it
  under the same terms as the ruby language itself, see the file COPYING for
  details.
=end

module Icalendar

  class Calendar < Component
    ical_component :events, :todos, :journals, :freebusys, :timezones

    ical_property :calscale, :calendar_scale
    ical_property :prodid, :product_id
    ical_property :version
    ical_property :ip_method

    def initialize()
      super("VCALENDAR")
      @properties = {}
      @property_params = {}

      # Set some defaults
      self.calscale = "GREGORIAN"    # Who knows, but this is the only one in the spec.
      self.prodid = "iCalendar-Ruby" # Current product... Should be overwritten
      self.version = "2.0" # Version of the specification
    end

    def event(&block)
      e = Event.new
      self.add_component e

      e.instance_eval &block if block

      e
    end

    def todo(&block)
      e = Todo.new
      self.add_component e

      e.instance_eval &block if block

      e
    end

    def journal(&block)
      e = Journal.new
      self.add_component e

      e.instance_eval &block if block

      e
    end

    def freebusy(&block)
      e = Freebusy.new
      self.add_component e

      e.instance_eval &block if block

      e
    end

    def timezone(&block)
      e = Timezone.new
      self.add_component e

      e.instance_eval &block if block

      e
    end
  end # class Calendar

end # module Icalendar

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
icalendar-0.96.1 lib/icalendar/calendar.rb
icalendar-0.96.2 lib/icalendar/calendar.rb
icalendar-0.96.3 lib/icalendar/calendar.rb
icalendar-0.96.4 lib/icalendar/calendar.rb