Sha256: f09616929c01a92723003f0e571f40d248f77280b5a19feec9aa4d6db19a20fc
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 KB
Contents
module SAXMachine class SAXConfig class CollectionConfig attr_reader :name attr_reader :default_xmlns def initialize(name, options) @name = name.to_s @class = options[:class] @as = options[:as].to_s @xmlns = case options[:xmlns] when Array then options[:xmlns] when String then [options[:xmlns]] else nil end @default_xmlns = options[:default_xmlns] if @default_xmlns && @xmlns && !@xmlns.include?(EMPTY_STRING) @xmlns << EMPTY_STRING end @record_events = options[:events] end def handler(nsstack) if @default_xmlns && (nsstack.nil? || nsstack[EMPTY_STRING] == EMPTY_STRING) nsstack = NSStack.new(nsstack, nsstack) nsstack[EMPTY_STRING] = @default_xmlns end unless @record_events SAXHandler.new(@class.new, nsstack) else SAXEventRecorder.new(nsstack) end end def accessor as end def xmlns_match?(ns) @xmlns.nil? || @xmlns.include?(ns) end protected def as @as end def class @class || @name end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sporkmonger-sax-machine-0.1.1 | lib/sax-machine/sax_collection_config.rb |
sporkmonger-sax-machine-0.1.0 | lib/sax-machine/sax_collection_config.rb |