Class: Reprise::TimeOfDay Private
- Inherits:
-
Object
- Object
- Reprise::TimeOfDay
- Defined in:
- lib/reprise/time_of_day.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: InvalidHashError, RangeError, UnsupportedTypeError
Constant Summary collapse
- DEFAULT_TIME_OF_DAY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ hour: 0, minute: 0, second: 0 }.freeze
- TIME_OF_DAY_ATTRIBUTES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
DEFAULT_TIME_OF_DAY.keys.freeze
Instance Method Summary collapse
-
#initialize(time_of_day) ⇒ TimeOfDay
constructor
private
A new instance of TimeOfDay.
- #to_h ⇒ Hash private
Constructor Details
#initialize(time_of_day) ⇒ TimeOfDay
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of TimeOfDay.
29 30 31 32 33 34 |
# File 'lib/reprise/time_of_day.rb', line 29 def initialize(time_of_day) return initialize_from_hash(time_of_day) if time_of_day.is_a?(Hash) return initialize_from_time(time_of_day) if time_of_day.is_a?(Time) raise UnsupportedTypeError, "#{time_of_day.class} is not a supported type" end |
Instance Method Details
#to_h ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 42 43 44 45 |
# File 'lib/reprise/time_of_day.rb', line 39 def to_h { hour:, minute:, second: } end |