Class: Sprockets::Sass::Importer
- Inherits:
-
Sass::Importers::Base
- Object
- Sass::Importers::Base
- Sprockets::Sass::Importer
- Defined in:
- lib/sprockets/sass/importer.rb
Constant Summary collapse
- GLOB =
/\*|\[.+\]/
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Reference to the Sprockets context.
Instance Method Summary collapse
- #find(path, options) ⇒ Object
- #find_relative(path, base_path, options) ⇒ Object
-
#initialize(context) ⇒ Importer
constructor
A new instance of Importer.
- #key(path, options) ⇒ Object
- #mtime(path, options) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(context) ⇒ Importer
Returns a new instance of Importer.
13 14 15 |
# File 'lib/sprockets/sass/importer.rb', line 13 def initialize(context) @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Reference to the Sprockets context
10 11 12 |
# File 'lib/sprockets/sass/importer.rb', line 10 def context @context end |
Instance Method Details
#find(path, options) ⇒ Object
27 28 29 |
# File 'lib/sprockets/sass/importer.rb', line 27 def find(path, ) engine_from_path(path, nil, ) end |
#find_relative(path, base_path, options) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/sprockets/sass/importer.rb', line 18 def find_relative(path, base_path, ) if path =~ GLOB engine_from_glob(path, base_path, ) else engine_from_path(path, base_path, ) end end |
#key(path, options) ⇒ Object
41 42 43 44 |
# File 'lib/sprockets/sass/importer.rb', line 41 def key(path, ) path = Pathname.new(path) ["#{self.class.name}:#{path.dirname.}", path.basename] end |
#mtime(path, options) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/sprockets/sass/importer.rb', line 32 def mtime(path, ) if pathname = resolve(path) pathname.mtime end rescue Errno::ENOENT nil end |
#to_s ⇒ Object
47 48 49 |
# File 'lib/sprockets/sass/importer.rb', line 47 def to_s "#{self.class.name}:#{context.pathname}" end |