Method: GetText::ErbParser#parse

Defined in:
lib/gettext/tools/parser/erb.rb

#parse(file, targets = []) ⇒ Object

:nodoc:



30
31
32
33
34
35
36
# File 'lib/gettext/tools/parser/erb.rb', line 30

def parse(file, targets = []) # :nodoc:
  src = ERB.new(IO.readlines(file).join).src
  # Remove magic comment prepended by erb in Ruby 1.9.
  src.sub!(/\A#.*?coding[:=].*?\n/, '') if src.respond_to?(:encode)
  erb = src.split(/$/)
  RubyParser.parse_lines(file, erb, targets)
end