Sha256: 4212aba3ca4cd22244dc629fa08c5254a87a7bef09d8c6215831dda87544d3e4
Contents?: true
Size: 691 Bytes
Versions: 3
Compression:
Stored size: 691 Bytes
Contents
require 'xsd_model/parser' require 'xsd_model/xsdize' module XsdModel class UnknownOptionType < StandardError; end using Xsdize def self.parse(xml_string, options = {}) Parser.call(xml_string, normalize_options(options)) end private def self.normalize_options(options) options.transform_values do |value| case value when Proc then value when String, Symbol then -> (child) { [value.xsdize].include? child.name } when Array then -> (child) { value.map(&:xsdize).include? child.name } else fail UnknownOptionType, 'Option given has to be either String, Symbol, Array, or Proc.' end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
xsd_model-0.7.0 | lib/xsd_model.rb |
xsd_model-0.6.0 | lib/xsd_model.rb |
xsd_model-0.5.0 | lib/xsd_model.rb |