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



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

def config
  @config ||= children.map {|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

#to_sObject



23
24
25
# File 'lib/junoser/xsd/simple_type.rb', line 23

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