Class: Icalendar::Values::UtcOffset
Instance Attribute Summary
#ical_params
Instance Method Summary
collapse
#ical_param, #params_ical, #to_ical, #value, value_type, #value_type
Constructor Details
#initialize(value, params = {}) ⇒ UtcOffset
Returns a new instance of UtcOffset.
6
7
8
9
10
11
12
13
|
# File 'lib/icalendar/values/utc_offset.rb', line 6
def initialize(value, params = {})
if value.is_a? Icalendar::Values::UtcOffset
value = value.value
else
value = OpenStruct.new parse_fields(value)
end
super value, params
end
|
Instance Method Details
15
16
17
18
|
# File 'lib/icalendar/values/utc_offset.rb', line 15
def behind?
return false if zero_offset?
value.behind
end
|
#to_s ⇒ Object
24
25
26
27
28
29
30
31
|
# File 'lib/icalendar/values/utc_offset.rb', line 24
def to_s
str = "#{behind? ? '-' : '+'}#{'%02d' % hours}:#{'%02d' % minutes}"
if seconds > 0
"#{str}:#{'%02d' % seconds}"
else
str
end
end
|
#value_ical ⇒ Object
20
21
22
|
# File 'lib/icalendar/values/utc_offset.rb', line 20
def value_ical
"#{behind? ? '-' : '+'}#{'%02d' % hours}#{'%02d' % minutes}#{'%02d' % seconds if seconds > 0}"
end
|