Sha256: e00c791b435949be51b45ce23423ade4d5d8c40f3a20a76137bb6dfc755651b0

Contents?: true

Size: 1.45 KB

Versions: 8

Compression:

Stored size: 1.45 KB

Contents

module RiCal
  module CoreExtensions #:nodoc:
    module Time #:nodoc:
      #- ©2009 Rick DeNatale
      #- All rights reserved. Refer to the file README.txt for the license
      #
      module Conversions
        # Return an RiCal::PropertyValue::DateTime representing the receiver
        def to_ri_cal_date_time_value(timezone_finder = nil) #:nodoc:
          RiCal::PropertyValue::DateTime.new(
               timezone_finder, 
               :value => strftime("%Y%m%dT%H%M%S"), 
               :params => {"TZID" => self.tzid || :default})
        end

        alias_method :to_ri_cal_date_or_date_time_value, :to_ri_cal_date_time_value #:nodoc:
        alias_method :to_ri_cal_occurrence_list_value, :to_ri_cal_date_time_value #:nodoc:

        # Return the natural ri_cal_property for this object
        def to_ri_cal_property_value(timezone_finder = nil) #:nodoc:
          to_ri_cal_date_time_value(timezone_finder)
        end
        
        def to_overlap_range_start
          to_datetime
        end
        
        alias_method :to_overlap_range_end, :to_overlap_range_start
        
        # Return a copy of this object which will be interpreted as a floating time.
        def with_floating_timezone
          dup.set_tzid(:floating)
        end
        
        unless Time.instance_methods.map {|selector| selector.to_sym}.include?(:to_datetime)
          require 'date'
          ::Time.send(:public, :to_datetime)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 5 rubygems

Version Path
demingfactor-ri_cal-0.10.0 lib/ri_cal/core_extensions/time/conversions.rb
demingfactor-ri_cal-0.9.0 lib/ri_cal/core_extensions/time/conversions.rb
awallis-ri_cal-0.8.8 lib/ri_cal/core_extensions/time/conversions.rb
justinsoong-ri_cal-0.8.9 lib/ri_cal/core_extensions/time/conversions.rb
justinsoong-ri_cal-0.8.8 lib/ri_cal/core_extensions/time/conversions.rb
micahwedemeyer-ri_cal-0.8.10 lib/ri_cal/core_extensions/time/conversions.rb
micahwedemeyer-ri_cal-0.8.9 lib/ri_cal/core_extensions/time/conversions.rb
ri_cal-0.8.8 lib/ri_cal/core_extensions/time/conversions.rb