washout_builder 0.12.3 → 0.12.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/helpers/washout_builder_helper.rb +160 -134
- data/lib/washout_builder/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
M2JhN2Y4NzUzNWRkMmRmMTFiZGZiZTlkNzkxMjA3YzhjYWUwOGZjNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjFkM2ZmZGYxZjU5M2Y3ODJmYzVjZGM4OTI2M2I2ODg4OTJmMDNmNw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MWU0Mzc2ZDc3Mzg3NTRjODJmNGQ1YTY0YTg5NGVhOWJhZWVmNDhhMDA0NjUw
|
10
|
+
ZDU4YWRkYmE0MjllZjM1YWU4ZjhjMGNkMzM3MjFkMzIxNTcwMzM4YzhjODZl
|
11
|
+
NDFjZmM1OTNhZDc4MGM2YmFhMTQ2Mzc2YWZjMDFlYWU3NjE5ZDU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzM0MjI0MDhlOTdiZjY1YjE4YjY3ODNlYTg1N2E1MTY2MmRjZjJkZWZjYWQx
|
14
|
+
YjQ3MmMyNWQ0ZTVlODc1ODVhMGIyYjZkMDIxYWVhNGZjMzNmNThmMmEyMjBi
|
15
|
+
MDQ4NzRiNzExNjZhNTcwZmViZWFlZmQ1ODM1ZjM2ZGM4YmJkNWI=
|
@@ -4,39 +4,49 @@ module WashoutBuilderHelper
|
|
4
4
|
types.each { |hash| create_complex_type_html(xml, hash[:obj], hash[:class], hash[:ancestors]) }
|
5
5
|
end
|
6
6
|
|
7
|
+
|
8
|
+
|
9
|
+
def create_element_type_html(pre, complex_class, element)
|
10
|
+
unless complex_class.nil?
|
11
|
+
if element.multiplied == false
|
12
|
+
pre << "<a href='##{complex_class}'><span class='lightBlue'>#{complex_class}</span></a> <span class='bold'>#{element.name}</span>"
|
13
|
+
else
|
14
|
+
pre << "<a href='##{complex_class}'><span class='lightBlue'>Array of #{complex_class}</span></a> <span class='bold'>#{element.name}</span>"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
def create_class_type_html(xml, class_name, ancestors)
|
21
|
+
xml.h3 { |pre| pre << "#{class_name} #{ancestors.blank? ? "" : "<small>(extends <a href='##{ancestors[0].to_s.classify}'>#{ancestors[0].to_s.classify}</a>)</small>" } " }
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
def create_complex_type_element_html(xml, element)
|
26
|
+
element.type = "string" if element.type == "text"
|
27
|
+
element.type = "integer" if element.type == "int"
|
28
|
+
xml.li { |pre|
|
29
|
+
if WashoutBuilder::Type::BASIC_TYPES.include?(element.type)
|
30
|
+
pre << "<span class='blue'>#{element.type}</span> <span class='bold'>#{element.name}</span>"
|
31
|
+
else
|
32
|
+
complex_class = element.get_complex_class_name
|
33
|
+
create_element_type_html(pre, complex_class, element)
|
34
|
+
end
|
35
|
+
}
|
36
|
+
end
|
7
37
|
|
8
38
|
|
9
39
|
def create_complex_type_html(xml, param, class_name, ancestors)
|
10
40
|
unless param.blank?
|
11
41
|
xml.a( "name" => "#{class_name}") { }
|
12
|
-
|
13
|
-
|
42
|
+
|
43
|
+
create_class_type_html(xml, class_name, ancestors)
|
14
44
|
if param.is_a?(WashOut::Param)
|
15
45
|
xml.ul("class" => "pre") {
|
16
|
-
|
17
46
|
param.map.each do |element|
|
18
|
-
|
19
|
-
# raise YAML::dump(element) if class_name.include?("ype") and element.name == "members"
|
20
|
-
xml.li { |pre|
|
21
|
-
if WashoutBuilder::Type::BASIC_TYPES.include?(element.type)
|
22
|
-
element.type = "integer" if element.type == "int"
|
23
|
-
pre << "<span class='blue'>#{element.type}</span> <span class='bold'>#{element.name}</span>"
|
24
|
-
else
|
25
|
-
complex_class = element.get_complex_class_name
|
26
|
-
unless complex_class.nil?
|
27
|
-
if element.multiplied == false
|
28
|
-
pre << "<a href='##{complex_class}'><span class='lightBlue'>#{complex_class}</span></a> <span class='bold'>#{element.name}</span>"
|
29
|
-
else
|
30
|
-
pre << "<a href='##{complex_class}'><span class='lightBlue'>Array of #{complex_class}</span></a> <span class='bold'>#{element.name}</span>"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
}
|
35
|
-
|
47
|
+
create_complex_type_element_html(xml, element)
|
36
48
|
end
|
37
|
-
|
38
49
|
}
|
39
|
-
|
40
50
|
end
|
41
51
|
end
|
42
52
|
end
|
@@ -50,31 +60,37 @@ module WashoutBuilderHelper
|
|
50
60
|
end
|
51
61
|
end
|
52
62
|
|
63
|
+
def create_virtus_model_complex_element_type(pre, attr_primitive, attribute, array)
|
64
|
+
attribute_primitive = array == true ? "Array of #{attr_primitive}" : "#{attr_primitive}"
|
65
|
+
pre << "<a href='##{attr_primitive}'><span class='lightBlue'> #{attribute_primitive}</span></a> <span class='bold'>#{attribute}</span>"
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
def create_html_virtus_model_element_type(xml, attribute, attr_details)
|
70
|
+
xml.li { |pre|
|
71
|
+
if WashoutBuilder::Type::BASIC_TYPES.include?(attr_details[:primitive].to_s.downcase) || attr_details[:primitive] == "nilclass"
|
72
|
+
pre << "<span class='blue'>#{attr_details[:primitive].to_s.downcase == "nilclass" ? "string" : attr_details[:primitive].to_s.downcase }</span> <span class='bold'>#{attribute}</span>"
|
73
|
+
|
74
|
+
else
|
75
|
+
if attr_details[:primitive].to_s.downcase == "array"
|
76
|
+
|
77
|
+
attr_primitive = WashoutBuilder::Type::BASIC_TYPES.include?(attr_details[:member_type].to_s.downcase) ? attr_details[:member_type].to_s.downcase : attr_details[:member_type]
|
78
|
+
create_virtus_model_complex_element_type(pre,attr_primitive, attribute, true )
|
79
|
+
else
|
80
|
+
create_virtus_model_complex_element_type(pre,attr_details[:primitive], attribute, false )
|
81
|
+
end
|
82
|
+
end
|
83
|
+
}
|
84
|
+
end
|
53
85
|
|
54
|
-
|
55
86
|
|
56
87
|
def create_html_virtus_model_type(xml, param, fault_structure, ancestors)
|
57
88
|
if param.is_a?(Class)
|
58
|
-
xml
|
89
|
+
create_class_type_html(xml, param, ancestors)
|
59
90
|
xml.a("name" => "#{param}") {}
|
60
91
|
xml.ul("class" => "pre") {
|
61
|
-
|
62
|
-
|
63
92
|
fault_structure.each do |attribute, attr_details|
|
64
|
-
xml
|
65
|
-
if WashoutBuilder::Type::BASIC_TYPES.include?(attr_details[:primitive].to_s.downcase) || attr_details[:primitive] == "nilclass"
|
66
|
-
pre << "<span class='blue'>#{attr_details[:primitive].to_s.downcase == "nilclass" ? "string" : attr_details[:primitive].to_s.downcase }</span> <span class='bold'>#{attribute}</span>"
|
67
|
-
|
68
|
-
else
|
69
|
-
if attr_details[:primitive].to_s.downcase == "array"
|
70
|
-
|
71
|
-
attr_primitive = WashoutBuilder::Type::BASIC_TYPES.include?(attr_details[:member_type].to_s.downcase) ? attr_details[:member_type].to_s.downcase : attr_details[:member_type]
|
72
|
-
pre << "<a href='##{attr_primitive}'><span class='lightBlue'>Array of #{attr_primitive}</span></a> <span class='bold'>#{attribute}</span>"
|
73
|
-
else
|
74
|
-
pre << "<a href='##{attr_details[:primitive] }'><span class='lightBlue'>#{attr_details[:primitive]}</span></a> <span class='bold'>#{attribute}</span>"
|
75
|
-
end
|
76
|
-
end
|
77
|
-
}
|
93
|
+
create_html_virtus_model_element_type(xml, attribute, attr_details)
|
78
94
|
end
|
79
95
|
}
|
80
96
|
end
|
@@ -87,73 +103,35 @@ module WashoutBuilderHelper
|
|
87
103
|
end
|
88
104
|
end
|
89
105
|
|
106
|
+
|
107
|
+
def create_return_complex_type_html(xml, complex_class, builder_out)
|
108
|
+
return_content = builder_out[0].multiplied == false ? "#{complex_class}" : "Array of #{complex_class}"
|
109
|
+
xml.span("class" => "pre") { xml.a("href" => "##{complex_class}") { |xml| xml.span("class" => "lightBlue") { |y| y<<"#{return_content}" } } }
|
110
|
+
end
|
90
111
|
|
91
|
-
|
92
|
-
def
|
93
|
-
|
94
|
-
xml.
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
complex_class = formats[:builder_out][0].get_complex_class_name
|
101
|
-
if WashoutBuilder::Type::BASIC_TYPES.include?(formats[:builder_out][0].type)
|
102
|
-
xml.span("class" => "blue") { |y| y<< "#{formats[:builder_out][0].type}" }
|
103
|
-
else
|
104
|
-
unless complex_class.nil?
|
105
|
-
if formats[:builder_out][0].multiplied == false
|
106
|
-
pre << "<a href='##{complex_class}'><span class='lightBlue'>#{complex_class}</span></a>"
|
107
|
-
else
|
108
|
-
pre << "<a href='##{complex_class}'><span class='lightBlue'>Array of #{complex_class}</span></a>"
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
else
|
113
|
-
pre << "void"
|
114
|
-
end
|
115
|
-
|
116
|
-
xml.span("class" => "bold") {|y| y << "#{operation} (" }
|
117
|
-
mlen = formats[:builder_in].size
|
118
|
-
xml.br if mlen > 1
|
119
|
-
spacer = " "
|
120
|
-
if mlen > 0
|
121
|
-
j=0
|
122
|
-
while j<mlen
|
123
|
-
param = formats[:builder_in][j]
|
124
|
-
complex_class = param.get_complex_class_name
|
125
|
-
use_spacer = mlen > 1 ? true : false
|
126
|
-
if WashoutBuilder::Type::BASIC_TYPES.include?(param.type)
|
127
|
-
pre << "#{use_spacer ? spacer: ''}<span class='blue'>#{param.type}</span> <span class='bold'>#{param.name}</span>"
|
112
|
+
|
113
|
+
def create_return_type_html(xml, formats)
|
114
|
+
xml.p "Return value:"
|
115
|
+
xml.ul {
|
116
|
+
xml.li {
|
117
|
+
unless formats[:builder_out].nil?
|
118
|
+
complex_class = formats[:builder_out][0].get_complex_class_name
|
119
|
+
if WashoutBuilder::Type::BASIC_TYPES.include?(formats[:builder_out][0].type)
|
120
|
+
xml.span("class" => "pre") { |xml| xml.span("class" => "blue") { |sp| sp << "#{formats[:builder_out][0].type}" } }
|
128
121
|
else
|
129
|
-
unless complex_class.nil?
|
130
|
-
if param.multiplied == false
|
131
|
-
pre << "#{use_spacer ? spacer: ''}<a href='##{complex_class}'><span class='lightBlue'>#{complex_class}</span></a> <span class='bold'>#{param.name}</span>"
|
132
|
-
else
|
133
|
-
pre << "#{use_spacer ? spacer: ''}<a href='##{complex_class}'><span class='lightBlue'>Array of #{complex_class}</span></a> <span class='bold'>#{param.name}</span>"
|
134
|
-
end
|
135
|
-
end
|
122
|
+
create_return_complex_type_html(xml, complex_class, formats[:builder_out]) unless complex_class.nil?
|
136
123
|
end
|
137
|
-
|
138
|
-
|
139
|
-
end
|
140
|
-
if mlen > 1
|
141
|
-
xml.br
|
142
|
-
end
|
143
|
-
if (j+1) == mlen
|
144
|
-
xml.span("class" => "bold") {|y| y << ")" }
|
145
|
-
end
|
146
|
-
j+=1
|
124
|
+
else
|
125
|
+
xml.span("class" => "pre") { |sp| sp << "void" }
|
147
126
|
end
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
127
|
+
|
128
|
+
}
|
153
129
|
}
|
154
|
-
|
130
|
+
end
|
131
|
+
|
132
|
+
|
133
|
+
def create_parameters_html(xml, formats)
|
155
134
|
xml.p "Parameters:"
|
156
|
-
|
157
135
|
xml.ul {
|
158
136
|
j=0
|
159
137
|
mlen = formats[:builder_in].size
|
@@ -164,47 +142,21 @@ module WashoutBuilderHelper
|
|
164
142
|
if WashoutBuilder::Type::BASIC_TYPES.include?(param.type)
|
165
143
|
pre << "<span class='blue'>#{param.type}</span> <span class='bold'>#{param.name}</span>"
|
166
144
|
else
|
167
|
-
|
168
|
-
if param.multiplied == false
|
169
|
-
pre << "<a href='##{complex_class}'><span class='lightBlue'>#{complex_class}</span></a> <span class='bold'>#{param.name}</span>"
|
170
|
-
else
|
171
|
-
pre << "<a href='##{complex_class}'><span class='lightBlue'>Array of #{complex_class}</span></a> <span class='bold'>#{param.name}</span>"
|
172
|
-
end
|
173
|
-
end
|
145
|
+
create_element_type_html(pre, complex_class, param)
|
174
146
|
end
|
175
147
|
}
|
176
148
|
j+=1
|
177
149
|
end
|
178
|
-
|
179
|
-
}
|
180
|
-
|
181
|
-
xml.p "Return value:"
|
182
|
-
xml.ul {
|
183
|
-
xml.li {
|
184
|
-
unless formats[:builder_out].nil?
|
185
|
-
complex_class = formats[:builder_out][0].get_complex_class_name
|
186
|
-
if WashoutBuilder::Type::BASIC_TYPES.include?(formats[:builder_out][0].type)
|
187
|
-
xml.span("class" => "pre") { |xml| xml.span("class" => "blue") { |sp| sp << "#{formats[:builder_out][0].type}" } }
|
188
|
-
else
|
189
|
-
unless complex_class.nil?
|
190
|
-
if formats[:builder_out][0].multiplied == false
|
191
|
-
xml.span("class" => "pre") { xml.a("href" => "##{complex_class}") { |xml| xml.span("class" => "lightBlue") { |y| y<<"#{complex_class}" } } }
|
192
|
-
else
|
193
|
-
xml.span("class" => "pre") { xml.a("href" => "##{complex_class}") { |xml| xml.span("class" => "lightBlue") { |y| y<<"Array of #{complex_class}" } } }
|
194
|
-
end
|
195
|
-
end
|
196
|
-
end
|
197
|
-
else
|
198
|
-
xml.span("class" => "pre") { |sp| sp << "void" }
|
199
|
-
end
|
200
|
-
|
201
|
-
}
|
150
|
+
|
202
151
|
}
|
152
|
+
end
|
153
|
+
|
154
|
+
def create_exceptions_list_html(xml, formats)
|
203
155
|
unless formats[:raises].blank?
|
204
156
|
faults = formats[:raises]
|
205
157
|
faults = [formats[:raises]] if !faults.is_a?(Array)
|
206
158
|
|
207
|
-
faults = faults.select { |x|
|
159
|
+
faults = faults.select { |x| WashoutBuilder::Type.valid_fault_class?(x) }
|
208
160
|
unless faults.blank?
|
209
161
|
xml.p "Exceptions:"
|
210
162
|
xml.ul {
|
@@ -215,5 +167,79 @@ module WashoutBuilderHelper
|
|
215
167
|
end
|
216
168
|
end
|
217
169
|
end
|
170
|
+
|
171
|
+
|
172
|
+
def create_html_public_method_return_type(xml,pre, formats)
|
173
|
+
unless formats[:builder_out].nil?
|
174
|
+
complex_class = formats[:builder_out][0].get_complex_class_name
|
175
|
+
if WashoutBuilder::Type::BASIC_TYPES.include?(formats[:builder_out][0].type)
|
176
|
+
xml.span("class" => "blue") { |y| y<< "#{formats[:builder_out][0].type}" }
|
177
|
+
else
|
178
|
+
unless complex_class.nil?
|
179
|
+
if formats[:builder_out][0].multiplied == false
|
180
|
+
pre << "<a href='##{complex_class}'><span class='lightBlue'>#{complex_class}</span></a>"
|
181
|
+
else
|
182
|
+
pre << "<a href='##{complex_class}'><span class='lightBlue'>Array of #{complex_class}</span></a>"
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
else
|
187
|
+
pre << "void"
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
def create_html_public_method_arguments_complex_type(pre, spacer, use_spacer, complex_class, param)
|
192
|
+
argument_content = param.multiplied == false ? "#{complex_class}" : "Array of #{complex_class}"
|
193
|
+
pre << "#{use_spacer ? spacer: ''}<a href='##{complex_class}'><span class='lightBlue'>#{argument_content}</span></a> <span class='bold'>#{param.name}</span>"
|
194
|
+
end
|
195
|
+
|
196
|
+
def create_html_public_method_arguments(xml, pre, operation, formats)
|
197
|
+
xml.span("class" => "bold") {|y| y << "#{operation} (" }
|
198
|
+
mlen = formats[:builder_in].size
|
199
|
+
xml.br if mlen > 1
|
200
|
+
spacer = " "
|
201
|
+
if mlen > 0
|
202
|
+
j=0
|
203
|
+
while j<mlen
|
204
|
+
param = formats[:builder_in][j]
|
205
|
+
complex_class = param.get_complex_class_name
|
206
|
+
use_spacer = mlen > 1 ? true : false
|
207
|
+
if WashoutBuilder::Type::BASIC_TYPES.include?(param.type)
|
208
|
+
pre << "#{use_spacer ? spacer: ''}<span class='blue'>#{param.type}</span> <span class='bold'>#{param.name}</span>"
|
209
|
+
else
|
210
|
+
unless complex_class.nil?
|
211
|
+
create_html_public_method_arguments_complex_type(pre, spacer, use_spacer, complex_class, param)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
if j< (mlen-1)
|
215
|
+
xml.span ", "
|
216
|
+
end
|
217
|
+
if mlen > 1
|
218
|
+
xml.br
|
219
|
+
end
|
220
|
+
if (j+1) == mlen
|
221
|
+
xml.span("class" => "bold") {|y| y << ")" }
|
222
|
+
end
|
223
|
+
j+=1
|
224
|
+
end
|
225
|
+
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
|
230
|
+
def create_html_public_method(xml, operation, formats)
|
231
|
+
# raise YAML::dump(formats[:builder_in])
|
232
|
+
xml.h3 "#{operation}"
|
233
|
+
xml.a("name" => "#{operation}") {}
|
234
|
+
|
235
|
+
xml.p("class" => "pre"){ |pre|
|
236
|
+
create_html_public_method_return_type(xml,pre, formats)
|
237
|
+
create_html_public_method_arguments(xml, pre, operation, formats)
|
238
|
+
}
|
239
|
+
xml.p "#{formats[:description]}" if !formats[:description].blank?
|
240
|
+
create_parameters_html(xml, formats)
|
241
|
+
create_return_type_html(xml, formats)
|
242
|
+
create_exceptions_list_html(xml, formats)
|
243
|
+
end
|
218
244
|
|
219
245
|
end
|