Class: Sass::Importers::HTTP
- Inherits:
-
Base
- Object
- Base
- Sass::Importers::HTTP
- Defined in:
- lib/remote-sass/importer.rb
Instance Method Summary collapse
- #find(uri, options) ⇒ Object
- #find_relative(uri, base, options) ⇒ Object
-
#initialize(root) ⇒ HTTP
constructor
A new instance of HTTP.
- #key(uri, options) ⇒ Object
- #mtime(uri, options) ⇒ Object
- #to_s ⇒ Object
Constructor Details
Instance Method Details
#find(uri, options) ⇒ Object
20 21 22 |
# File 'lib/remote-sass/importer.rb', line 20 def find uri, _find @root + uri, end |
#find_relative(uri, base, options) ⇒ Object
16 17 18 |
# File 'lib/remote-sass/importer.rb', line 16 def find_relative uri, base, _find @root + base + uri, end |
#key(uri, options) ⇒ Object
41 42 43 |
# File 'lib/remote-sass/importer.rb', line 41 def key(uri, ) [self.class.name, uri] end |
#mtime(uri, options) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/remote-sass/importer.rb', line 24 def mtime uri, uri = URI.parse uri return unless scheme_allowed? uri Net::HTTP.start(uri.host, uri.port) do |http| response = http.head uri.request_uri if response.is_a?(Net::HTTPOK) && response['Last-Modified'] Time.parse response['Last-Modified'] elsif response.is_a? Net::HTTPOK # we must assume that it just changed Time.now else nil end end end |
#to_s ⇒ Object
45 46 47 |
# File 'lib/remote-sass/importer.rb', line 45 def to_s @root.to_s end |