@@ -695,35 +695,36 @@ def httpdate
695
695
getutc . strftime ( '%a, %d %b %Y %T GMT' )
696
696
end
697
697
698
- #
699
- # Returns a string which represents the time as a dateTime defined by XML
700
- # Schema:
701
- #
702
- # CCYY-MM-DDThh:mm:ssTZD
703
- # CCYY-MM-DDThh:mm:ss.sssTZD
704
- #
705
- # where TZD is Z or [+-]hh:mm.
706
- #
707
- # If self is a UTC time, Z is used as TZD. [+-]hh:mm is used otherwise.
708
- #
709
- # +fraction_digits+ specifies a number of digits to use for fractional
710
- # seconds. Its default value is 0.
711
- #
712
- # require 'time'
713
- #
714
- # t = Time.now
715
- # t.iso8601 # => "2011-10-05T22:26:12-04:00"
716
- #
717
- # You must require 'time' to use this method.
718
- #
719
- def xmlschema ( fraction_digits = 0 )
720
- fraction_digits = fraction_digits . to_i
721
- s = strftime ( "%FT%T" )
722
- if fraction_digits > 0
723
- s << strftime ( ".%#{ fraction_digits } N" )
698
+ unless method_defined? ( :xmlschema )
699
+ #
700
+ # Returns a string which represents the time as a dateTime defined by XML
701
+ # Schema:
702
+ #
703
+ # CCYY-MM-DDThh:mm:ssTZD
704
+ # CCYY-MM-DDThh:mm:ss.sssTZD
705
+ #
706
+ # where TZD is Z or [+-]hh:mm.
707
+ #
708
+ # If self is a UTC time, Z is used as TZD. [+-]hh:mm is used otherwise.
709
+ #
710
+ # +fraction_digits+ specifies a number of digits to use for fractional
711
+ # seconds. Its default value is 0.
712
+ #
713
+ # require 'time'
714
+ #
715
+ # t = Time.now
716
+ # t.iso8601 # => "2011-10-05T22:26:12-04:00"
717
+ #
718
+ # You must require 'time' to use this method.
719
+ #
720
+ def xmlschema ( fraction_digits = 0 )
721
+ fraction_digits = fraction_digits . to_i
722
+ s = strftime ( "%FT%T" )
723
+ if fraction_digits > 0
724
+ s << strftime ( ".%#{ fraction_digits } N" )
725
+ end
726
+ s << ( utc? ? 'Z' : strftime ( "%:z" ) )
724
727
end
725
- s << ( utc? ? 'Z' : strftime ( "%:z" ) )
726
728
end
727
- alias iso8601 xmlschema
729
+ alias iso8601 xmlschema unless method_defined? ( :iso8601 )
728
730
end
729
-
0 commit comments