Class: Datetimepicker::DateAndTimeManipulator
- Inherits:
-
Struct
- Object
- Struct
- Datetimepicker::DateAndTimeManipulator
- Defined in:
- lib/datetimepicker/date_and_time_manipulator.rb
Instance Attribute Summary collapse
-
#date_format ⇒ Object
Returns the value of attribute date_format.
-
#datetime ⇒ Object
Returns the value of attribute datetime.
-
#time_format ⇒ Object
Returns the value of attribute time_format.
Instance Method Summary collapse
-
#date ⇒ Object
Public: get the date component of datetime.
-
#date=(new_date) ⇒ Object
Public: set the date component of datetime.
-
#time ⇒ Object
Public: get the time component of datetime.
-
#time=(new_time) ⇒ Object
Public: set the time component of datetime.
Instance Attribute Details
#date_format ⇒ Object
Returns the value of attribute date_format
14 15 16 |
# File 'lib/datetimepicker/date_and_time_manipulator.rb', line 14 def date_format @date_format end |
#datetime ⇒ Object
Returns the value of attribute datetime
14 15 16 |
# File 'lib/datetimepicker/date_and_time_manipulator.rb', line 14 def datetime @datetime end |
#time_format ⇒ Object
Returns the value of attribute time_format
14 15 16 |
# File 'lib/datetimepicker/date_and_time_manipulator.rb', line 14 def time_format @time_format end |
Instance Method Details
#date ⇒ Object
Public: get the date component of datetime.
Returns a String in the format of date_format.
19 20 21 |
# File 'lib/datetimepicker/date_and_time_manipulator.rb', line 19 def date datetime.strftime(date_format) end |
#date=(new_date) ⇒ Object
Public: set the date component of datetime.
new_date - The String representation of date component for datetime.
The String should be in the format of date_format.
27 28 29 |
# File 'lib/datetimepicker/date_and_time_manipulator.rb', line 27 def date=(new_date) self.datetime = parse_date_and_time(new_date, time) end |
#time ⇒ Object
Public: get the time component of datetime.
Returns a String in the format of time_format.
34 35 36 |
# File 'lib/datetimepicker/date_and_time_manipulator.rb', line 34 def time datetime.strftime(time_format) end |
#time=(new_time) ⇒ Object
Public: set the time component of datetime.
new_time - The String representation of time component for datetime.
The String should be in the format of time_format.
42 43 44 |
# File 'lib/datetimepicker/date_and_time_manipulator.rb', line 42 def time=(new_time) self.datetime = parse_date_and_time(date, new_time) end |