Class: Haml::Compiler

Inherits:
Object
  • Object
show all
Defined in:
lib/haml_source_line.rb

Instance Method Summary collapse

Instance Method Details

#compile(node) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/haml_source_line.rb', line 8

def compile(node)
  if node.type == :tag
    file = @options[:filename]

    if defined?(::Rails)
      file.gsub!(::Rails.root.to_s, '')
      file.gsub!(/^\//, '')
    end

    node.value.attributes.merge!('data-source-line' => "#{file}:#{node.line}")
  end
  orig_compile(node)
end

#orig_compileObject



6
# File 'lib/haml_source_line.rb', line 6

alias_method :orig_compile, :compile