require 'sass'

module SCSSLint
  class Engine
    ENGINE_OPTIONS = { cache: false, syntax: :scss }

    def initialize(scss_or_filename)
      if File.exists?(scss_or_filename)
        @engine = Sass::Engine.for_file(scss_or_filename, ENGINE_OPTIONS)
      else
        @engine = Sass::Engine.new(scss_or_filename, ENGINE_OPTIONS)
      end
    end

    def tree
      @engine.to_tree
    end
  end
end

require 'sass'

module SCSSLint
  class Engine
    ENGINE_OPTIONS = { cache: false, syntax: :scss }

    attr_reader :contents

    def initialize(scss_or_filename)
      if File.exists?(scss_or_filename)
        @engine = Sass::Engine.for_file(scss_or_filename, ENGINE_OPTIONS)
        @contents = File.open(scss_or_filename, 'r').read
      else
        @engine = Sass::Engine.new(scss_or_filename, ENGINE_OPTIONS)
        @contents = scss_or_filename
      end
    end

    def tree
      @engine.to_tree
    end
  end
end

Store actual string contents of SCSS files
Store actual string contents of SCSS files

This will enable us to write linters that can access the original file
in cases where line number or other such information can be inferred
separately.

Change-Id: I02182d1fdd19f1ce1a4c4e072c7a0655f1732889
Reviewed-on: https://gerrit.causes.com/16557
Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
Tested-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
Reviewed-by: Greg Hurrell <79e2475f81a6317276bf7cbb3958b20d289b78df@causes.com>
