Sha256: 540dd24c347e889dcf47f3f8f1b47d9d382ae11f54356108a116e8a7854368de

Contents?: true

Size: 1.28 KB

Versions: 19

Compression:

Stored size: 1.28 KB

Contents

=begin
  Copyright (C) 2008 Sam Roberts

  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

require 'vpim/dirinfo'
require 'vpim/field'
require 'vpim/rfc2425'
require 'vpim/vpim'
require 'vpim/property/base'
require 'vpim/property/common'
require 'vpim/property/recurrence'

module Vpim
  class Icalendar

    class Vjournal
      include Vpim::Icalendar::Property::Base
      include Vpim::Icalendar::Property::Common
      include Vpim::Icalendar::Property::Recurrence

      def initialize(fields) #:nodoc:
        outer, inner = Vpim.outer_inner(fields)

        @properties = Vpim::DirectoryInfo.create(outer)

        @elements = inner
      end

      # TODO - derive everything from Icalendar::Component to get rid of this kind of stuff?
      def fields #:nodoc:
        f = properties.to_a
        last = f.pop
        f.push @elements
        f.push last
      end

      def properties #:nodoc:
        @properties
      end

      # Create a Vjournal component.
      def self.create(fields=[])
        di = DirectoryInfo.create([], 'VJOURNAL')

        Vpim::DirectoryInfo::Field.create_array(fields).each { |f| di.push_unique f }

        new(di.to_a)
      end

    end

  end
end

Version data entries

19 entries across 19 versions & 11 rubygems

Version Path
fraser-vpim-0.658 lib/vpim/vjournal.rb
fraser-vpim-0.659 lib/vpim/vjournal.rb
fraser-vpim-rails-0.658 lib/vpim/vjournal.rb
fraser-vpim-rails-0.659 lib/vpim/vjournal.rb
xing-vpim-0.658.1 lib/vpim/vjournal.rb
vpim2-0.0.1 lib/vpim/vjournal.rb
vpim-rails-reinteractive-0.7 lib/vpim/vjournal.rb
vpim-rails-0.665 lib/vpim/vjournal.rb
thoughtafter-vpim-0.7.0.1 lib/vpim/vjournal.rb
vpim-rails-0.664 lib/vpim/vjournal.rb
vpim-rails-0.663 lib/vpim/vjournal.rb
vpim-rails-0.662 lib/vpim/vjournal.rb
scashin133-vpim-9.4.0 lib/vpim/vjournal.rb
vpim-rails-0.661 lib/vpim/vjournal.rb
mumboe-vpim-0.7 lib/vpim/vjournal.rb
mumboe-vpim-0.695 lib/vpim/vjournal.rb
fairtilizer-vpim-0.695 lib/vpim/vjournal.rb
vpim-0.695 lib/vpim/vjournal.rb
vpim-0.658 lib/vpim/vjournal.rb