Method: GetText::ErbParser#parse
- Defined in:
- lib/gettext/tools/parser/erb.rb
#parse ⇒ Array<POEntry>
Extracts messages from @path.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/gettext/tools/parser/erb.rb', line 66 def parse content = IO.read(@path) if @@erb_accept_keyword_arguments erb = ERB.new(content, trim_mode: "-") else erb = ERB.new(content, nil, "-") end src = erb.src # Force the src encoding back to the encoding in magic comment # or original content. encoding = detect_encoding(src) || content.encoding src.force_encoding(encoding) # Remove magic comment prepended by erb in Ruby 1.9. src = src.gsub(MAGIC_COMMENT, "") RubyParser.new(@path, @options).parse_source(src) end |