Sha256: 0cb2c5f3c8f4475f09db725403142d6e5ad61c7d95faf123955ba194be1de771

Contents?: true

Size: 386 Bytes

Versions: 5

Compression:

Stored size: 386 Bytes

Contents

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

5 entries across 5 versions & 1 rubygems

Version Path
imgkit-1.3.9 lib/imgkit/source.rb
imgkit-1.3.8 lib/imgkit/source.rb
imgkit-1.3.7 lib/imgkit/source.rb
imgkit-1.3.6 lib/imgkit/source.rb
imgkit-1.3.5 lib/imgkit/source.rb