Sha256: 6f07948509db510312cb6e7fdd59780846c0ecb4f891fdb198b5f084f3c12085

Contents?: true

Size: 545 Bytes

Versions: 5

Compression:

Stored size: 545 Bytes

Contents

class LinkOracle
  module Extractor
    class Meta < Base
      def type
        :meta
      end

      def title
        found = parsed_body.at_xpath("/html/head/title/text()")
        found ? [found.content] : []
      end

      def image
        get_content("/html/head/meta[contains(@name, 'thumbnail')]")
      end

      def description
        get_content("/html/head/meta[translate(
          @name,
          'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
          'abcdefghijklmnopqrstuvwxyz'
        ) = 'description']")
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
link_oracle-0.0.5 lib/link_oracle/extractor/meta.rb
link_oracle-0.0.4 lib/link_oracle/extractor/meta.rb
link_oracle-0.0.3 lib/link_oracle/extractor/meta.rb
link_oracle-0.0.2 lib/link_oracle/extractor/meta.rb
link_oracle-0.0.1 lib/link_oracle/extractor/meta.rb