Sha256: 2cdc510637256aa933c2216856f9e82c61060139c49a4ebd045b6cf7e55773d8

Contents?: true

Size: 886 Bytes

Versions: 51

Compression:

Stored size: 886 Bytes

Contents

module MetaInspector
  module Parsers
    ##
    # Base class from where the specialized parsers inherit from.
    #
    # On initialization a main parser is expected, so the specialized
    # parsers can request the parsed document to the main parser, and
    # then perform the searches on it.
    #
    # The main parser also serves as a message hub between the specialized
    # parsers. For example, the ImagesParser needs to know the base_url
    # in order to absolutify image URLs, so it delegates it to the main parser
    # which, in turn, delegates it to the LinksParser.
    #
    class Base
      def initialize(main_parser)
        @main_parser = main_parser
      end

      extend Forwardable

      private

      # Cleans up nokogiri search results
      def cleanup(results)
        results.map { |r| r.value.strip }.reject(&:empty?).uniq
      end
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
metainspector-5.3.1 lib/meta_inspector/parsers/base.rb
metainspector-5.3.0 lib/meta_inspector/parsers/base.rb
metainspector-5.2.3 lib/meta_inspector/parsers/base.rb
metainspector-5.2.2 lib/meta_inspector/parsers/base.rb
metainspector-5.2.1 lib/meta_inspector/parsers/base.rb
metainspector-5.2.0 lib/meta_inspector/parsers/base.rb
metainspector-5.1.3 lib/meta_inspector/parsers/base.rb
metainspector-5.1.2 lib/meta_inspector/parsers/base.rb
metainspector-5.1.1 lib/meta_inspector/parsers/base.rb
metainspector-5.1.0 lib/meta_inspector/parsers/base.rb
metainspector-5.0.2 lib/meta_inspector/parsers/base.rb
metainspector-5.0.1 lib/meta_inspector/parsers/base.rb
metainspector-5.0.0 lib/meta_inspector/parsers/base.rb
metainspector-5.0.0.rc1 lib/meta_inspector/parsers/base.rb
metainspector-4.7.2 lib/meta_inspector/parsers/base.rb
metainspector-4.7.1 lib/meta_inspector/parsers/base.rb
metainspector-4.7.0 lib/meta_inspector/parsers/base.rb
metainspector-4.6.1 lib/meta_inspector/parsers/base.rb
metainspector-4.6.0 lib/meta_inspector/parsers/base.rb
metainspector-4.5.0 lib/meta_inspector/parsers/base.rb