Sha256: 1b2ebd304aa7076dc64bf04431addb34ba9c6ebda88881efd4d6bd9f203dff03

Contents?: true

Size: 805 Bytes

Versions: 4

Compression:

Stored size: 805 Bytes

Contents

module SAXMachine
  class SAXConfig
    
    class CollectionConfig
      attr_reader :name
      
      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
      end
      
      def handler(nsstack)
        SAXHandler.new(@class.new, nsstack)
      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

4 entries across 4 versions & 2 rubygems

Version Path
astro-sax-machine-0.0.16 lib/sax-machine/sax_collection_config.rb
astro-sax-machine-0.0.17 lib/sax-machine/sax_collection_config.rb
julien51-sax-machine-0.0.17 lib/sax-machine/sax_collection_config.rb
julien51-sax-machine-0.0.18 lib/sax-machine/sax_collection_config.rb