Class: VitalsImage::Optimizer::Url

Inherits:
VitalsImage::Optimizer show all
Defined in:
lib/vitals_image/optimizer/url.rb

Class Method Summary collapse

Methods inherited from VitalsImage::Optimizer

#html_options, #initialize, #lazy_load?, #native_lazy_load?, #non_native_lazy_load?, #src

Constructor Details

This class inherits a constructor from VitalsImage::Optimizer

Class Method Details

.accept?(source) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
# File 'lib/vitals_image/optimizer/url.rb', line 5

def self.accept?(source)
  uri = URI.parse(source)
  %w( http https ).include?(uri.scheme)
rescue URI::BadURIError
  false
rescue URI::InvalidURIError
  false
end