Sha256: 21af4fbc04973275a340c28a86809389ed0027274916621afc001409c18a3981

Contents?: true

Size: 416 Bytes

Versions: 9

Compression:

Stored size: 416 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) || @source.kind_of?(Tempfile)
    end
    
    def html?
      !(url? || file?)
    end
    
    def to_s
      file? ? @source.path : @source
    end
    
  end
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
imgkit-1.6.3 lib/imgkit/source.rb
imgkit-1.6.2 lib/imgkit/source.rb
imgkit-1.6.1 lib/imgkit/source.rb
imgkit-1.6.0 lib/imgkit/source.rb
imgkit-1.5.0 lib/imgkit/source.rb
imgkit-1.4.2 lib/imgkit/source.rb
imgkit-1.4.1 lib/imgkit/source.rb
imgkit-1.4.0 lib/imgkit/source.rb
imgkit-1.3.10 lib/imgkit/source.rb