Class: PoParser::Tokenizer
- Inherits:
-
Object
- Object
- PoParser::Tokenizer
- Defined in:
- lib/poparser/tokenizer.rb
Overview
Feed each block of PO file to Parser.
Instance Method Summary collapse
- #extract_entries(path) ⇒ Object
-
#initialize ⇒ Tokenizer
constructor
A new instance of Tokenizer.
Constructor Details
Instance Method Details
#extract_entries(path) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/poparser/tokenizer.rb', line 11 def extract_entries(path) @po.path = path block = '' File.open(path, 'r') do |f| f.each_line do |line| if line.match(/^\n$/) @po << parse_block(block) block = '' elsif f.eof? block += line @po << parse_block(block) else block += line end end end @po end |