Sha256: a31a452f31a001e64d56b0df206fcad05f302159457b4a7fb855e5b6cd6c3db3

Contents?: true

Size: 370 Bytes

Versions: 1

Compression:

Stored size: 370 Bytes

Contents

class WeasyPrint
  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

1 entries across 1 versions & 1 rubygems

Version Path
weasyprint-0.1.0 lib/weasyprint/source.rb