lib/slim_lint/document.rb in slim_lint-0.14.0 vs lib/slim_lint/document.rb in slim_lint-0.15.0
- old
+ new
@@ -1,13 +1,10 @@
# frozen_string_literal: true
module SlimLint
# Represents a parsed Slim document and its associated metadata.
class Document
- # File name given to source code parsed from just a string.
- STRING_SOURCE = '(string)'.freeze
-
# @return [SlimLint::Configuration] Configuration used to parse template
attr_reader :config
# @return [String] Slim template file path
attr_reader :file
@@ -27,10 +24,10 @@
# @param options [Hash]
# @option options :file [String] file name of document that was parsed
# @raise [Slim::Parser::Error] if there was a problem parsing the document
def initialize(source, options)
@config = options[:config]
- @file = options.fetch(:file, STRING_SOURCE)
+ @file = options.fetch(:file, nil)
process_source(source)
end
private