Class: SlimLint::Document
- Inherits:
-
Object
- Object
- SlimLint::Document
- Defined in:
- lib/slim_lint/document.rb
Overview
Represents a parsed Slim document and its associated metadata.
Instance Attribute Summary collapse
-
#config ⇒ SlimLint::Configuration
readonly
Configuration used to parse template.
-
#file ⇒ String
readonly
Slim template file path.
-
#sexp ⇒ SlimLint::Sexp
readonly
Sexpression representing the parsed document.
-
#source ⇒ String
readonly
Original source code.
-
#source_lines ⇒ Array<String>
readonly
Original source code as an array of lines.
Instance Method Summary collapse
-
#initialize(source, options) ⇒ Document
constructor
Parses the specified Slim code into a Document.
Constructor Details
#initialize(source, options) ⇒ Document
Parses the specified Slim code into a SlimLint::Document.
27 28 29 30 31 32 |
# File 'lib/slim_lint/document.rb', line 27 def initialize(source, ) @config = [:config] @file = .fetch(:file, nil) process_source(source) end |
Instance Attribute Details
#config ⇒ SlimLint::Configuration (readonly)
Returns Configuration used to parse template.
7 8 9 |
# File 'lib/slim_lint/document.rb', line 7 def config @config end |
#file ⇒ String (readonly)
Returns Slim template file path.
10 11 12 |
# File 'lib/slim_lint/document.rb', line 10 def file @file end |
#sexp ⇒ SlimLint::Sexp (readonly)
Returns Sexpression representing the parsed document.
13 14 15 |
# File 'lib/slim_lint/document.rb', line 13 def sexp @sexp end |
#source ⇒ String (readonly)
Returns original source code.
16 17 18 |
# File 'lib/slim_lint/document.rb', line 16 def source @source end |
#source_lines ⇒ Array<String> (readonly)
Returns original source code as an array of lines.
19 20 21 |
# File 'lib/slim_lint/document.rb', line 19 def source_lines @source_lines end |