Sha256: 6e293eef40e1fc2845f8aa4b3a6f1bf528576c96699210d61b4af71291b104a0

Contents?: true

Size: 552 Bytes

Versions: 12

Compression:

Stored size: 552 Bytes

Contents

# encoding: utf-8
require "uri"
require "net/http"
require "ostruct"

module SocialProfile
  class Utils
    def self.head(url, options = {})
      uri = URI.parse(url)
      response = nil

      Net::HTTP.start(uri.host, uri.port) do |http|
        http.open_timeout = 2
        http.read_timeout = 2
        response = http.head(uri.request_uri)
      end

      Response.new(uri, response, options)
    end

    def self.blank?(value)
      value.nil? || value.to_s.empty?
    end

    def self.exists?(value)
      !blank?(value)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
social_profile-0.3.2 lib/social_profile/utils.rb
social_profile-0.3.1 lib/social_profile/utils.rb
social_profile-0.3.0 lib/social_profile/utils.rb
social_profile-0.2.2 lib/social_profile/utils.rb
social_profile-0.2.1 lib/social_profile/utils.rb
social_profile-0.2.0 lib/social_profile/utils.rb
social_profile-0.1.4 lib/social_profile/utils.rb
social_profile-0.1.3 lib/social_profile/utils.rb
social_profile-0.1.2 lib/social_profile/utils.rb
social_profile-0.1.1 lib/social_profile/utils.rb
social_profile-0.1.0 lib/social_profile/utils.rb
social_profile-0.0.1 lib/social_profile/utils.rb