Class: Junoser::Xsd::Choice
- Inherits:
-
Object
- Object
- Junoser::Xsd::Choice
- Includes:
- Base
- Defined in:
- lib/junoser/xsd/choice.rb
Constant Summary
Constants included from Base
Instance Attribute Summary
Attributes included from Base
Instance Method Summary collapse
Methods included from Base
#children, #initialize, #inspect, #oneliner?, #root?
Instance Method Details
#config ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/junoser/xsd/choice.rb', line 9 def config @config ||= children.map {|child| case child.name when 'element' Junoser::Xsd::Element.new(child, depth: @depth+1, parent: self) when 'choice' Junoser::Xsd::Choice.new(child, depth: @depth+1, parent: self) else raise "ERROR: unknown element: #{child.name}" end } end |
#to_s ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/junoser/xsd/choice.rb', line 22 def to_s case when config.empty? '' when has_single_child_of?(Junoser::Xsd::Choice) format('c(', config.first.config.map(&:to_s).join(",\n"), ')') else format('c(', config.map(&:to_s).join(",\n"), ')') end end |
#unbounded? ⇒ Boolean
33 34 35 |
# File 'lib/junoser/xsd/choice.rb', line 33 def unbounded? xml['maxOccurs'] == 'unbounded' end |