Method: GetText::ErbParser#parse
- Defined in:
- lib/gettext/tools/parser/erb.rb
#parse ⇒ Array<POEntry>
Extracts messages from @path.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/gettext/tools/parser/erb.rb', line 63 def parse content = IO.read(@path) src = ERB.new(content).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, ).parse_source(src) end |