Class: Icalendar::Values::Time
- Inherits:
-
Icalendar::Value
- Object
- SimpleDelegator
- Icalendar::Value
- Icalendar::Values::Time
- Includes:
- Helpers::TimeWithZone
- Defined in:
- lib/icalendar/values/time.rb
Constant Summary collapse
- FORMAT =
'%H%M%S'
Constants inherited from Icalendar::Value
Icalendar::Value::VALUE_TYPE_GSUB_REGEX_1, Icalendar::Value::VALUE_TYPE_GSUB_REGEX_2
Instance Attribute Summary
Attributes included from Helpers::TimeWithZone
Attributes inherited from Icalendar::Value
Instance Method Summary collapse
-
#initialize(value, params = {}) ⇒ Time
constructor
A new instance of Time.
- #value_ical ⇒ Object
Methods included from Helpers::TimeWithZone
Methods inherited from Icalendar::Value
#==, #ical_param, #params_ical, #to_ical, #value, value_type, #value_type
Constructor Details
#initialize(value, params = {}) ⇒ Time
Returns a new instance of Time.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/icalendar/values/time.rb', line 14 def initialize(value, params = {}) if value.is_a? String params['tzid'] = 'UTC' if value.end_with? 'Z' super ::DateTime.strptime(value, FORMAT).to_time, params elsif value.respond_to? :to_time super value.to_time, params else super end end |