File: zulu_date_time.rb

package info (click to toggle)
mhc 1.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,320 kB
  • ctags: 3,529
  • sloc: ruby: 12,404; lisp: 7,448; makefile: 70; sh: 69
file content (34 lines) | stat: -rw-r--r-- 847 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require 'date'
module RiCal
  class PropertyValue
    #- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
    #
    # RiCal::PropertyValue::CalAddress represents an icalendar CalAddress property value
    # which is defined in RFC 2445 section 4.3.5 pp 35-37
    class ZuluDateTime < PropertyValue::DateTime
      
      def tzid
        "UTC"
      end

      def value=(val) # :nodoc:
        if DateTime === val
          @date_time_value = val
        else
          super(val)
        end
        @date_time_value = @date_time_value.utc if @date_time_value
      end
      
      def to_ri_cal_zulu_date_time
        self
      end
      
      def self.convert(timezone_finder, ruby_object) # :nodoc:
          result = super
          result.to_ri_cal_zulu_date_time
      end
      
    end
  end
end