Class: SocialProfile::Utils
- Inherits:
-
Object
- Object
- SocialProfile::Utils
- Defined in:
- lib/social_profile/utils.rb
Class Method Summary collapse
Class Method Details
.blank?(value) ⇒ Boolean
21 22 23 |
# File 'lib/social_profile/utils.rb', line 21 def self.blank?(value) value.nil? || value.to_s.empty? end |
.exists?(value) ⇒ Boolean
25 26 27 |
# File 'lib/social_profile/utils.rb', line 25 def self.exists?(value) !blank?(value) end |
.head(url, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/social_profile/utils.rb', line 8 def self.head(url, = {}) 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, ) end |