Sha256: 0cdde6c1ca9d54c20b37808d6cb253c0b7c6da1b4a2a240cfe6e0a4b3d8edf28

Contents?: true

Size: 537 Bytes

Versions: 2

Compression:

Stored size: 537 Bytes

Contents

module Onebox
  module Engine
    class StackExchangeOnebox
      include Engine
      include HTML

      matches do
        # /^http:\/\/(?:(?:(?<subsubdomain>\w*)\.)?(?<subdomain>\w*)\.)?(?<domain>#{DOMAINS.join('|')})\.com\/(?:questions|q)\/(?<question>\d*)/
        find "stackexchange.com"
      end

      private

      def data
        {
          url: @url,
          title: raw.css(".question-hyperlink").inner_text,
          question: raw.css(".question .post-text p").first.inner_text
        }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
onebox-1.0.1 lib/onebox/engine/stack_exchange_onebox.rb
onebox-1.0.0 lib/onebox/engine/stack_exchange_onebox.rb