Class: KakaxiParse::Datatype::DateTime
- Inherits:
-
Object
- Object
- KakaxiParse::Datatype::DateTime
- Defined in:
- lib/kakaxi_parse/datatypes/datetime.rb
Instance Attribute Summary collapse
-
#day ⇒ Object
Returns the value of attribute day.
-
#hour ⇒ Object
Returns the value of attribute hour.
-
#minute ⇒ Object
Returns the value of attribute minute.
-
#month ⇒ Object
Returns the value of attribute month.
-
#second ⇒ Object
Returns the value of attribute second.
-
#year ⇒ Object
Returns the value of attribute year.
Instance Method Summary collapse
-
#initialize(*args) ⇒ DateTime
constructor
A new instance of DateTime.
Constructor Details
#initialize(*args) ⇒ DateTime
Returns a new instance of DateTime.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/kakaxi_parse/datatypes/datetime.rb', line 6 def initialize(*args) if args.length == 1 && args[0].class == String datetime = DateTime.strptime(args[0], '%Y-%m-%dT%H:%M:%S.%LZ') @year = datetime.year @month = datetime.month @day = datetime.day @hour = datetime.hour @minute = datetime.minute @second = datetime.second else @year = args[0] || nil @month = args[1] || nil @day = args[2] || nil @hour = args[3] || nil @minute = args[4] || nil @second = args[5] || nil end end |
Instance Attribute Details
#day ⇒ Object
Returns the value of attribute day.
4 5 6 |
# File 'lib/kakaxi_parse/datatypes/datetime.rb', line 4 def day @day end |
#hour ⇒ Object
Returns the value of attribute hour.
4 5 6 |
# File 'lib/kakaxi_parse/datatypes/datetime.rb', line 4 def hour @hour end |
#minute ⇒ Object
Returns the value of attribute minute.
4 5 6 |
# File 'lib/kakaxi_parse/datatypes/datetime.rb', line 4 def minute @minute end |
#month ⇒ Object
Returns the value of attribute month.
4 5 6 |
# File 'lib/kakaxi_parse/datatypes/datetime.rb', line 4 def month @month end |
#second ⇒ Object
Returns the value of attribute second.
4 5 6 |
# File 'lib/kakaxi_parse/datatypes/datetime.rb', line 4 def second @second end |
#year ⇒ Object
Returns the value of attribute year.
4 5 6 |
# File 'lib/kakaxi_parse/datatypes/datetime.rb', line 4 def year @year end |