Sha256: 4d66d9ccdb873e6785a143464dc135485dd7558a954769c4eca23c49a1a207cb

Contents?: true

Size: 1.28 KB

Versions: 30

Compression:

Stored size: 1.28 KB

Contents

module Watir
  module Generator
    class SVG::SpecExtractor < Base::SpecExtractor

      private

      def extract_interface_map
        list = @doc.search("//div[@id='chapter-eltindex']//ul/li")
        list.any? or raise 'could not find elements list'

        @interface_map = parse_list(list)
      end

      def build_result
        {}.tap do |result|
          @interface_map.each do |tag, interface|
            result[tag] = fetch_interface(interface)
          end
        end
      end

      def parse_list(list)
        {}.tap do |result|
          list.each do |node|
            tag_name = node.css('a span').inner_text.strip
            id = node.css('a').attr('href').to_s

            # Some interfaces are actually defined in different specs
            # (for example, clipPath), so we ignore them for now
            if id =~ /^#.+/
              interface_css = 'div.element-summary a.idlinterface'
              interface_name = @doc.css("#{id} #{interface_css}, #{id} ~ #{interface_css}").first.inner_text.strip

              result[tag_name] = interface_name
            end
          end
        end
      end

      def issued_interfaces
        %w(SVGHatchElement SVGHatchPathElement SVGSolidColorElement)
      end

    end # SVG::SpecExtractor
  end # Generator
end # Watir

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
watir-6.6.3 lib/watir/generator/svg/spec_extractor.rb
watir-6.6.2 lib/watir/generator/svg/spec_extractor.rb
watir-6.6.1 lib/watir/generator/svg/spec_extractor.rb
watir-6.6.0 lib/watir/generator/svg/spec_extractor.rb
watir-6.5.0 lib/watir/generator/svg/spec_extractor.rb
watir-6.4.3 lib/watir/generator/svg/spec_extractor.rb
watir-6.4.2 lib/watir/generator/svg/spec_extractor.rb
watir-6.4.1 lib/watir/generator/svg/spec_extractor.rb
watir-6.4.0 lib/watir/generator/svg/spec_extractor.rb
watir-6.4.0.rc2 lib/watir/generator/svg/spec_extractor.rb
watir-6.4.0.rc1 lib/watir/generator/svg/spec_extractor.rb
watir-6.3.0 lib/watir/generator/svg/spec_extractor.rb
watir-6.2.1 lib/watir/generator/svg/spec_extractor.rb
watir-6.2.0 lib/watir/generator/svg/spec_extractor.rb
watir-6.1.0 lib/watir/generator/svg/spec_extractor.rb
watir-6.0.3 lib/watir/generator/svg/spec_extractor.rb
watir-6.0.2 lib/watir/generator/svg/spec_extractor.rb
watir-6.0.1 lib/watir/generator/svg/spec_extractor.rb
watir-webdriver-0.9.9 lib/watir-webdriver/generator/svg/spec_extractor.rb
watir-6.0.0 lib/watir/generator/svg/spec_extractor.rb