Sha256: a45cbb3fd88e6751aaa6aaf991195418c21b8166688884055b6530dafae187e8

Contents?: true

Size: 385 Bytes

Versions: 12

Compression:

Stored size: 385 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(/^http/)
    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

12 entries across 12 versions & 1 rubygems

Version Path
imgkit-1.3.4 lib/imgkit/source.rb
imgkit-1.3.3 lib/imgkit/source.rb
imgkit-1.3.2 lib/imgkit/source.rb
imgkit-1.3.1 lib/imgkit/source.rb
imgkit-1.3.0 lib/imgkit/source.rb
imgkit-1.2.1 lib/imgkit/source.rb
imgkit-1.2.0 lib/imgkit/source.rb
imgkit-1.1.0 lib/imgkit/source.rb
imgkit-1.0.2 lib/imgkit/source.rb
imgkit-1.0.1 lib/imgkit/source.rb
imgkit-1.0.0 lib/imgkit/source.rb
imgkit-0.9.2 lib/imgkit/source.rb