Class: Junoser::Xsd::SimpleType

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/junoser/xsd/simple_type.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

#configObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/junoser/xsd/simple_type.rb', line 12

def config
  @config ||= children.map do |child|
    case child.name
    when 'restriction'
      Junoser::Xsd::Restriction.new(child, depth: @depth + 1, parent: self)
    when 'union'
      Junoser::Xsd::Union.new(child, depth: @depth + 1, parent: self)
    else
      raise "ERROR: unknown element: #{child.name}"
    end
  end
end

#to_sObject



25
26
27
# File 'lib/junoser/xsd/simple_type.rb', line 25

def to_s
  fmt(config.first.to_s.strip)
end