Class: Icalendar::Value
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Icalendar::Value
show all
- Defined in:
- lib/icalendar/value.rb
Direct Known Subclasses
Icalendar::Values::Binary, Icalendar::Values::Boolean, Icalendar::Values::Date, Icalendar::Values::DateOrDateTime, Icalendar::Values::DateTime, Icalendar::Values::Duration, Icalendar::Values::Float, Icalendar::Values::Helpers::Array, Icalendar::Values::Integer, Icalendar::Values::Period, Icalendar::Values::Recur, Icalendar::Values::Text, Icalendar::Values::Time, Icalendar::Values::Uri, Icalendar::Values::UtcOffset
Constant Summary
collapse
- VALUE_TYPE_GSUB_REGEX_1 =
/\A.*::/.freeze
- VALUE_TYPE_GSUB_REGEX_2 =
/(?<!\A)[A-Z]/.freeze
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(value, params = {}) ⇒ Value
Returns a new instance of Value.
13
14
15
16
|
# File 'lib/icalendar/value.rb', line 13
def initialize(value, params = {})
@ical_params = Icalendar::DowncasedHash(params)
super value
end
|
Instance Attribute Details
#ical_params ⇒ Object
Returns the value of attribute ical_params.
11
12
13
|
# File 'lib/icalendar/value.rb', line 11
def ical_params
@ical_params
end
|
Instance Method Details
#==(other) ⇒ Object
48
49
50
51
52
53
54
|
# File 'lib/icalendar/value.rb', line 48
def ==(other)
if other.is_a?(Icalendar::Value)
super(other.value) && ical_params == other.ical_params
else
super
end
end
|
#ical_param(key, value) ⇒ Object
18
19
20
|
# File 'lib/icalendar/value.rb', line 18
def ical_param(key, value)
@ical_params[key] = value
end
|
#params_ical ⇒ Object
31
32
33
34
35
|
# File 'lib/icalendar/value.rb', line 31
def params_ical
unless ical_params.empty?
";#{ical_params.map { |name, value| param_ical name, value }.join ';'}"
end
end
|
#to_ical(default_type) ⇒ Object
26
27
28
29
|
# File 'lib/icalendar/value.rb', line 26
def to_ical(default_type)
ical_param 'value', self.value_type if needs_value_type?(default_type)
"#{params_ical}:#{value_ical}"
end
|
#value ⇒ Object
22
23
24
|
# File 'lib/icalendar/value.rb', line 22
def value
__getobj__
end
|
#value_type ⇒ Object
44
45
46
|
# File 'lib/icalendar/value.rb', line 44
def value_type
self.class.value_type
end
|