Sha256: 607fd52929b7c4e46933cfb38656f1810e9dbc67d0211a358faae8d85f8d8305

Contents?: true

Size: 655 Bytes

Versions: 9

Compression:

Stored size: 655 Bytes

Contents

class LinkOracle
  module Extractor
    class Base
      attr_reader :parsed_body, :url, :link_data

      def initialize(parsed_url)
        @parsed_body = parsed_url[:parsed_data]
        @url = parsed_url[:url]
        @link_data = LinkData::Data.new
      end

      def type
        raise "implement me"
      end

      def perform
        link_data.assign({
          titles: title,
          image_urls: image,
          descriptions: description
        })
      end

      def get_content(selector)
        found = parsed_body.xpath(selector).first
        (found && !found[:content].empty?) ? [found[:content]] : []
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
link_oracle-0.1.11 lib/link_oracle/extractor/base.rb
link_oracle-0.1.10 lib/link_oracle/extractor/base.rb
link_oracle-0.1.9 lib/link_oracle/extractor/base.rb
link_oracle-0.1.8 lib/link_oracle/extractor/base.rb
link_oracle-0.1.7 lib/link_oracle/extractor/base.rb
link_oracle-0.1.6 lib/link_oracle/extractor/base.rb
link_oracle-0.1.5 lib/link_oracle/extractor/base.rb
link_oracle-0.1.4 lib/link_oracle/extractor/base.rb
link_oracle-0.1.3 lib/link_oracle/extractor/base.rb