@@ -58,32 +58,17 @@ def readable_inspect
58
58
alias_method :default_inspect , :inspect
59
59
alias_method :inspect , :readable_inspect
60
60
61
- # Converts self to a Ruby Date object; time portion is discarded.
62
- def to_date
63
- ::Date . new ( year , month , day )
64
- end unless instance_methods ( false ) . include? ( :to_date )
65
-
66
61
# Attempts to convert self to a Ruby Time object; returns self if out of range of Ruby Time class.
67
62
# If self has an offset other than 0, self will just be returned unaltered, since there's no clean way to map it to a Time.
68
63
def to_time
69
64
self . offset == 0 ? ::Time . utc_time ( year , month , day , hour , min , sec , sec_fraction * 1000000 ) : self
70
65
end
71
66
72
- # To be able to keep Times, Dates and DateTimes interchangeable on conversions.
73
- def to_datetime
74
- self
75
- end unless instance_methods ( false ) . include? ( :to_datetime )
76
-
77
67
def self . civil_from_format ( utc_or_local , year , month = 1 , day = 1 , hour = 0 , min = 0 , sec = 0 )
78
68
offset = utc_or_local . to_sym == :local ? local_offset : 0
79
69
civil ( year , month , day , hour , min , sec , offset )
80
70
end
81
71
82
- # Converts datetime to an appropriate format for use in XML.
83
- def xmlschema
84
- strftime ( "%Y-%m-%dT%H:%M:%S%Z" )
85
- end unless instance_methods ( false ) . include? ( :xmlschema )
86
-
87
72
# Converts self to a floating-point number of seconds since the Unix epoch.
88
73
def to_f
89
74
seconds_since_unix_epoch . to_f
0 commit comments