Class: Junoser::Xsd::SimpleContent
- Inherits:
-
Object
- Object
- Junoser::Xsd::SimpleContent
show all
- Includes:
- Base
- Defined in:
- lib/junoser/xsd/simple_content.rb
Constant Summary
Constants included
from Base
Base::OFFSET
Instance Attribute Summary
Attributes included from Base
#parent, #xml
Instance Method Summary
collapse
Methods included from Base
#children, #initialize, #inspect, #oneliner?, #root?
Instance Method Details
#config ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/junoser/xsd/simple_content.rb', line 11
def config
@config ||= children.map do |child|
case child.name
when 'restriction'
Junoser::Xsd::Restriction.new(child, depth: @depth + 1, parent: self)
when 'extension'
'arg'
else
raise "ERROR: unknown element: #{child.name}"
end
end
end
|
#to_s ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/junoser/xsd/simple_content.rb', line 24
def to_s
return if config.empty?
raise "ERROR: simpleContent shouldn't have multiple children" if config.size > 1
child = config.first
child.is_a?(String) ? fmt(OFFSET + child) : child.to_s
end
|