Sha256: ea01f10fa2dddbc50bcb0f857e53fa6dfd7fcbcb6fc468bbc44ad67fae935f4a
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
module Spectifly module Xsd class Association < Spectifly::Base::Association def name Spectifly::Support.camelize(@field_name).gsub(/\W/, '') end def to_xsd(builder = nil) builder ||= ::Builder::XmlMarkup.new(:indent => 2) if relationship == 'belongs_to' attributes['name'] = "#{name}Id" attributes['type'] = "xs:string" else attributes['name'] = name attributes['type'] = "#{Spectifly::Support.lower_camelize(type)}Type" end attributes['minOccurs'] = '0' unless required? attributes['maxOccurs'] = 'unbounded' if multiple? block = embedded_block builder.xs :element, attributes, &block end def embedded_block if description || example Proc.new { |el| if description || example el.xs :annotation do |ann| ann.xs :documentation, description if description ann.xs :documentation, "Example: #{example}" if example end end } end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spectifly-0.0.7 | lib/spectifly/xsd/association.rb |