Sha256: b33e515787a93942559f70c781376da6711f04a36598b540f62f3e9a5e10aa37
Contents?: true
Size: 579 Bytes
Versions: 5
Compression:
Stored size: 579 Bytes
Contents
# frozen_string_literal: true module Onebox module Engine class PdfOnebox include Engine include LayoutSupport matches_regexp(/^(https?:)?\/\/.*\.pdf(\?.*)?$/i) always_https private def data begin size = Onebox::Helpers.fetch_content_length(@url) rescue raise "Unable to read pdf file: #{@url}" end { link: link, title: File.basename(uri.path), filesize: size ? Onebox::Helpers.pretty_filesize(size.to_i) : nil, } end end end end
Version data entries
5 entries across 5 versions & 1 rubygems