Sha256: cbc9cef2b064011a13231faaf7d16505d91d70f97b60436986ce8287e9a3b80d

Contents?: true

Size: 366 Bytes

Versions: 16

Compression:

Stored size: 366 Bytes

Contents

class PDFKit
  class Source
    def initialize(url_file_or_html)
      @source = url_file_or_html
    end
    
    def url?
      @source.is_a?(String) && @source.match(/\Ahttp/)
    end
    
    def file?
      @source.kind_of?(File)
    end
    
    def html?
      !(url? || file?)
    end
    
    def to_s
      file? ? @source.path : @source
    end
  end
end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
pdfkit-0.8.0 lib/pdfkit/source.rb
pdfkit-0.7.0 lib/pdfkit/source.rb
pdfkit-0.6.2 lib/pdfkit/source.rb
pdfkit-0.6.1 lib/pdfkit/source.rb
hssc_pdfkit-0.5.5 lib/pdfkit/source.rb
hssc_pdfkit-0.5.4 lib/pdfkit/source.rb
pdfkit-0.5.4 lib/pdfkit/source.rb
pdfkit-middleware-to-file-0.5.7 lib/pdfkit/source.rb
pdfkit-middleware-to-file-0.5.6 lib/pdfkit/source.rb
pdfkit-middleware-to-file-0.5.5 lib/pdfkit/source.rb
pdfkit-middleware-to-file-0.5.4 lib/pdfkit/source.rb
pdfkit-middleware-to-file-0.5.3 lib/pdfkit/source.rb
pdfkit-0.5.3 lib/pdfkit/source.rb
pdfkit-0.5.2 lib/pdfkit/source.rb
pdfkit-0.5.1 lib/pdfkit/source.rb
pdfkit-0.5.0 lib/pdfkit/source.rb