module SassC::ImportOnce::Importer

Public Instance Methods

imports(path, parent_path) click to toggle source
Calls superclass method
# File lib/sassc/import_once/importer.rb, line 5
def imports(path, parent_path)
  path, force_import = handle_force_import(path)
  reject_already_imported_imports(super(path, parent_path), force_import)
end

Private Instance Methods

handle_force_import(path) click to toggle source
# File lib/sassc/import_once/importer.rb, line 12
def handle_force_import(path)
  if path.end_with?("!")
    [path[0...-1], true]
  else
    [path, false]
  end
end
import_tracker_key(import) click to toggle source
# File lib/sassc/import_once/importer.rb, line 44
def import_tracker_key(import)
  import.path
end
imported!(import) click to toggle source
# File lib/sassc/import_once/importer.rb, line 52
def imported!(import)
  tracker << import_tracker_key(import)
end
imported?(import) click to toggle source
# File lib/sassc/import_once/importer.rb, line 48
def imported?(import)
  tracker.include?(import_tracker_key(import))
end
reject_already_imported_import(import, force_import) click to toggle source
# File lib/sassc/import_once/importer.rb, line 32
def reject_already_imported_import(import, force_import)
  return true unless import
  return true if !force_import && imported?(import)

  imported!(import)
  false
end
reject_already_imported_imports(imports, force_import) click to toggle source
# File lib/sassc/import_once/importer.rb, line 20
def reject_already_imported_imports(imports, force_import)
  return imports unless imports
  
  imports = [ imports ] unless imports.is_a?(Enumerable)
  imports.reject do |import|
    reject_already_imported_import(import, force_import)
  end
rescue => e
  puts e
  []
end
tracker() click to toggle source
# File lib/sassc/import_once/importer.rb, line 40
def tracker
  SassC::ImportOnce.import_tracker[options[:filename]] ||= Set.new
end