Class: SyntaxTree::Haml::Format::Formatter

Inherits:
Formatter
  • Object
show all
Defined in:
lib/syntax_tree/haml/format.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, *rest) ⇒ Formatter

Returns a new instance of Formatter.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/syntax_tree/haml/format.rb', line 9

def initialize(source, *rest)
  @literal_lines = {}
  source
    .lines
    .each
    .with_index(1) do |line, index|
      @literal_lines[index] = line.rstrip if line.start_with?("!")
    end

  super(source, *rest)
end

Instance Attribute Details

#literal_linesObject (readonly)

Returns the value of attribute literal_lines.



7
8
9
# File 'lib/syntax_tree/haml/format.rb', line 7

def literal_lines
  @literal_lines
end

#quoteObject (readonly)

Returns the value of attribute quote.



7
8
9
# File 'lib/syntax_tree/haml/format.rb', line 7

def quote
  @quote
end