Class: XMLRPC::DateTime
Instance Attribute Summary (collapse)
-
- (Object) day
Returns the value of attribute day.
-
- (Object) hour
Returns the value of attribute hour.
-
- (Object) min
Returns the value of attribute min.
-
- (Object) month
(also: #mon)
Returns the value of attribute month.
-
- (Object) sec
Returns the value of attribute sec.
-
- (Object) year
Returns the value of attribute year.
Instance Method Summary (collapse)
- - (Object) ==(o)
-
- (DateTime) initialize(year, month, day, hour, min, sec)
constructor
A new instance of DateTime.
- - (Object) to_a
- - (Object) to_date
- - (Object) to_time
Constructor Details
- (DateTime) initialize(year, month, day, hour, min, sec)
A new instance of DateTime
108 109 110 111 |
# File 'lib/xmlrpc/datetime.rb', line 108 def initialize(year, month, day, hour, min, sec) self.year, self.month, self.day = year, month, day self.hour, self.min, self.sec = hour, min, sec end |
Instance Attribute Details
- (Object) day
Returns the value of attribute day
72 73 74 |
# File 'lib/xmlrpc/datetime.rb', line 72 def day @day end |
- (Object) hour
Returns the value of attribute hour
72 73 74 |
# File 'lib/xmlrpc/datetime.rb', line 72 def hour @hour end |
- (Object) min
Returns the value of attribute min
72 73 74 |
# File 'lib/xmlrpc/datetime.rb', line 72 def min @min end |
- (Object) month Also known as: mon
Returns the value of attribute month
72 73 74 |
# File 'lib/xmlrpc/datetime.rb', line 72 def month @month end |
- (Object) sec
Returns the value of attribute sec
72 73 74 |
# File 'lib/xmlrpc/datetime.rb', line 72 def sec @sec end |
- (Object) year
Returns the value of attribute year
72 73 74 |
# File 'lib/xmlrpc/datetime.rb', line 72 def year @year end |
Instance Method Details
- (Object) ==(o)
129 130 131 |
# File 'lib/xmlrpc/datetime.rb', line 129 def ==(o) self.to_a == Array(o) rescue false end |
- (Object) to_a
125 126 127 |
# File 'lib/xmlrpc/datetime.rb', line 125 def to_a [@year, @month, @day, @hour, @min, @sec] end |
- (Object) to_date
121 122 123 |
# File 'lib/xmlrpc/datetime.rb', line 121 def to_date Date.new(*to_a[0,3]) end |
- (Object) to_time
113 114 115 116 117 118 119 |
# File 'lib/xmlrpc/datetime.rb', line 113 def to_time if @year >= 1970 Time.gm(*to_a) else nil end end |