dslize 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dslize/formatter/formatter.rb +5 -0
- data/lib/dslize/formatter/xsd_formatter.rb +14 -1
- data/lib/dslize/version.rb +1 -1
- data/sample.rb +4 -0
- metadata +3 -3
@@ -21,7 +21,20 @@ module DSLize
|
|
21
21
|
{ :has_one => nil, :has_many => "unbounded"}.each do |relation, max_occurs|
|
22
22
|
(options[relation] or []).each do |k, v|
|
23
23
|
named_object_if_needed(xsd, k, v) do
|
24
|
-
|
24
|
+
clazz = v[:type] or k
|
25
|
+
subclasses = get_subclasses(clazz)
|
26
|
+
if subclasses.empty?
|
27
|
+
xsd.element(nil, { :ref => clazz, :maxOccurs => max_occurs }.select { |k,v| !v.nil? })
|
28
|
+
else
|
29
|
+
xsd.choice({ :maxOccurs => max_occurs }.select { |k,v| !v.nil? }) do
|
30
|
+
subclasses.each do |sub_type|
|
31
|
+
xsd.element(nil, :ref => sub_type)
|
32
|
+
end
|
33
|
+
if !objects[clazz][:abstract]
|
34
|
+
xsd.element(nil, :ref => clazz)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
25
38
|
end
|
26
39
|
end
|
27
40
|
end
|
data/lib/dslize/version.rb
CHANGED
data/sample.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 4
|
9
|
+
version: 0.0.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- redox
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-07-
|
17
|
+
date: 2012-07-12 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|