Sha256: 0b32588cfab858e9c7f76a931b74a83175e4e75f1cc3cbeca66197956b25752f

Contents?: true

Size: 1.16 KB

Versions: 25

Compression:

Stored size: 1.16 KB

Contents

module Schematic
  module Generator
    class Types
      COMPLEX = {
        :integer => { :complex_type => "Integer", :xsd_type => "xs:integer" },
        :float => { :complex_type => "Float", :xsd_type => "xs:float" },
        :string => { :complex_type => "String", :xsd_type => "xs:string" },
        :text => { :complex_type => "Text", :xsd_type => "xs:string" },
        :datetime => { :complex_type => "DateTime", :xsd_type => "xs:dateTime" },
        :date => { :complex_type => "Date", :xsd_type => "xs:date" },
        :boolean => { :complex_type => "Boolean", :xsd_type => "xs:boolean" },
      }

      def self.xsd(builder)
        Types::COMPLEX.each do |key, value|
          complex_type_name = value[:complex_type]
          xsd_type = value[:xsd_type]
          builder.xs :complexType, "name" => complex_type_name do |complex_type|
            complex_type.xs :simpleContent do |simple_content|
              simple_content.xs :extension, "base" => xsd_type do |extension|
                extension.xs :attribute, "name" => "type", "type" => "xs:string", "use" => "optional"
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
schematic-0.5.0 lib/schematic/generator/types.rb
schematic-0.4.4 lib/schematic/generator/types.rb
schematic-0.4.3 lib/schematic/generator/types.rb
schematic-0.4.2 lib/schematic/generator/types.rb
schematic-0.4.1 lib/schematic/generator/types.rb
schematic-0.4.0 lib/schematic/generator/types.rb
schematic-0.3.8 lib/schematic/generator/types.rb
schematic-0.3.7 lib/schematic/generator/types.rb
schematic-0.3.6 lib/schematic/generator/types.rb
schematic-0.3.5 lib/schematic/generator/types.rb
schematic-0.3.4 lib/schematic/generator/types.rb
schematic-0.3.3 lib/schematic/generator/types.rb
schematic-0.3.2 lib/schematic/generator/types.rb
schematic-0.3.1 lib/schematic/generator/types.rb
schematic-0.3.0 lib/schematic/generator/types.rb
schematic-0.2.3 lib/schematic/generator/types.rb
schematic-0.2.1 lib/schematic/generator/types.rb
schematic-0.1.9 lib/schematic/generator/types.rb
schematic-0.1.8 lib/schematic/generator/types.rb
schematic-0.1.7 lib/schematic/generator/types.rb