Class: Sass::Importers::HTTP
- Inherits:
-
Base
- Object
- Base
- Sass::Importers::HTTP
- Defined in:
- lib/sassmagic/remote.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
30 31 32 |
# File 'lib/sassmagic/remote.rb', line 30 def find uri, _find @root + uri, end |
#find_relative(uri, base, options) ⇒ Object
27 28 29 |
# File 'lib/sassmagic/remote.rb', line 27 def find_relative uri, base, _find @root + base + uri, end |
#key(uri, options) ⇒ Object
51 52 53 |
# File 'lib/sassmagic/remote.rb', line 51 def key(uri, ) [self.class.name, uri] end |
#mtime(uri, options) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/sassmagic/remote.rb', line 34 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
55 56 57 |
# File 'lib/sassmagic/remote.rb', line 55 def to_s @root.to_s end |