Sha256: 27fbbc53fe02d1f5e4aac86f7ada994533ab6467a39198ea5bd1fda14157a696

Contents?: true

Size: 605 Bytes

Versions: 3

Compression:

Stored size: 605 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].empty?) ? [found[:content]] : []
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
link_oracle-0.1.2 lib/link_oracle/extractor/base.rb
link_oracle-0.1.1 lib/link_oracle/extractor/base.rb
link_oracle-0.1.0 lib/link_oracle/extractor/base.rb