Sha256: 2b6e8e1fe0bb93516772dd0fb42a15a4090a307b01032ac64d2666e64a5b9221
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" attributes['minOccurs'] = '0' unless required? end 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.6 | lib/spectifly/xsd/association.rb |