Sha256: b786200fe13795299273df65ab09b0a77135ba2986c55ee54b1cbc6a6496ec47

Contents?: true

Size: 553 Bytes

Versions: 1

Compression:

Stored size: 553 Bytes

Contents

module Smeargle
  class Sketch

    include Smeargle::Image

    attr_accessor :url, :min_width, :min_height

    def initialize url, args = {}
      @url = url
      args.each do |key, value|
        send "#{key}=", value
      end
    end

    def safe_url
      @safe_url ||=
        !URI.parse(url).scheme ? "http://#{url}" : url
    end

    def response_body
      @response_body ||= Nokogiri::HTML(open safe_url)
    end

    def clean_url
      @clean_url ||=
        URI(safe_url).scheme +
        '://' + URI(safe_url).host
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smeargle-1.0.1 lib/smeargle/sketch.rb