towsta 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/towsta/kinds/multiple.rb +40 -0
- data/lib/towsta/version.rb +1 -1
- metadata +2 -2
@@ -0,0 +1,40 @@
|
|
1
|
+
module Towsta
|
2
|
+
module Kinds
|
3
|
+
|
4
|
+
class MultipleKind < MainKind
|
5
|
+
|
6
|
+
attr_accessor :content
|
7
|
+
|
8
|
+
def initialize content=nil
|
9
|
+
self.set content
|
10
|
+
end
|
11
|
+
|
12
|
+
def get
|
13
|
+
return @content if @content.class == Array
|
14
|
+
aux = []
|
15
|
+
@content.to_s.split(' ').each do |i|
|
16
|
+
Vertical.all.each do |v|
|
17
|
+
horizontal = v.find_by_id i
|
18
|
+
aux << horizontal if horizontal
|
19
|
+
end
|
20
|
+
end
|
21
|
+
@content = aux
|
22
|
+
@content
|
23
|
+
end
|
24
|
+
|
25
|
+
def set content
|
26
|
+
return @content = content if content.class == Array
|
27
|
+
@content = content.to_s
|
28
|
+
end
|
29
|
+
|
30
|
+
def export
|
31
|
+
return @content.to_s if @content.class != Array
|
32
|
+
aux = ''
|
33
|
+
@content.each {|c| aux << c.id}
|
34
|
+
aux
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
data/lib/towsta/version.rb
CHANGED