Class: Icalendar::Values::Array
Instance Attribute Summary collapse
#ical_params
Instance Method Summary
collapse
#ical_param, #to_ical, #value, value_type
Constructor Details
#initialize(value, klass, params = {}, options = {}) ⇒ Array
Returns a new instance of Array.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/icalendar/values/array.rb', line 8
def initialize(value, klass, params = {}, options = {})
@value_delimiter = options[:delimiter] || ','
mapped = if value.is_a? ::Array
value.map do |v|
if v.is_a? Icalendar::Values::Array
Icalendar::Values::Array.new v.value, klass, v.ical_params, delimiter: v.value_delimiter
else
klass.new v, params
end
end
else
[klass.new(value, params)]
end
super mapped, params
end
|
Instance Attribute Details
#value_delimiter ⇒ Object
Returns the value of attribute value_delimiter.
6
7
8
|
# File 'lib/icalendar/values/array.rb', line 6
def value_delimiter
@value_delimiter
end
|
Instance Method Details
#params_ical ⇒ Object
24
25
26
27
28
29
|
# File 'lib/icalendar/values/array.rb', line 24
def params_ical
value.each do |v|
ical_params.merge! v.ical_params
end
super
end
|
37
38
39
40
|
# File 'lib/icalendar/values/array.rb', line 37
def valid?
klass = value.first.class
!value.all? { |v| v.class == klass }
end
|
#value_ical ⇒ Object
31
32
33
34
35
|
# File 'lib/icalendar/values/array.rb', line 31
def value_ical
value.map do |v|
v.value_ical
end.join value_delimiter
end
|
#value_type ⇒ Object
42
43
44
|
# File 'lib/icalendar/values/array.rb', line 42
def value_type
value.first.value_type
end
|