Sha256: 8707940a110e2b80315e6583a2f3c09fecf1409f6b6f071094d72a526fcf0e96

Contents?: true

Size: 575 Bytes

Versions: 8

Compression:

Stored size: 575 Bytes

Contents

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

      def initialize(parsed_body)
        @parsed_body = parsed_body
        @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]] : []
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
link_oracle-0.0.8 lib/link_oracle/extractor/base.rb
link_oracle-0.0.7 lib/link_oracle/extractor/base.rb
link_oracle-0.0.6 lib/link_oracle/extractor/base.rb
link_oracle-0.0.5 lib/link_oracle/extractor/base.rb
link_oracle-0.0.4 lib/link_oracle/extractor/base.rb
link_oracle-0.0.3 lib/link_oracle/extractor/base.rb
link_oracle-0.0.2 lib/link_oracle/extractor/base.rb
link_oracle-0.0.1 lib/link_oracle/extractor/base.rb