Class: JLDrill::Tatoeba::LinkFile
- Defined in:
- lib/jldrill/model/Tatoeba.rb
Constant Summary collapse
- LINK_RE =
/^(\d*)[\t](\d*)/
Instance Attribute Summary
Attributes inherited from DataFile
#encoding, #file, #lines, #parsed, #publisher, #stepSize
Instance Method Summary collapse
- #dataSize ⇒ Object
-
#finishParsing ⇒ Object
Don’t erase @lines because we need them later.
- #getLinksTo(index) ⇒ Object
-
#initialize ⇒ LinkFile
constructor
A new instance of LinkFile.
- #parseEntry ⇒ Object
Methods inherited from DataFile
#createLines, #eof?, #findEncoding, #fraction, #load, #loaded?, #parse, #parseChunk, #parser, #readLines, #reset, #setLoaded, #shortFilename
Constructor Details
#initialize ⇒ LinkFile
Returns a new instance of LinkFile.
57 58 59 60 61 |
# File 'lib/jldrill/model/Tatoeba.rb', line 57 def initialize() super @links = [] @stepSize = 1000 end |
Instance Method Details
#dataSize ⇒ Object
63 64 65 |
# File 'lib/jldrill/model/Tatoeba.rb', line 63 def dataSize @links.size end |
#finishParsing ⇒ Object
Don’t erase @lines because we need them later
76 77 78 |
# File 'lib/jldrill/model/Tatoeba.rb', line 76 def finishParsing setLoaded(true) end |
#getLinksTo(index) ⇒ Object
80 81 82 83 84 85 86 |
# File 'lib/jldrill/model/Tatoeba.rb', line 80 def getLinksTo(index) retVal = @links[index] if retVal.nil? retVal = [] end return retVal end |
#parseEntry ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/jldrill/model/Tatoeba.rb', line 67 def parseEntry if LINK_RE.match(@lines[@parsed]) index = $1.to_i (@links[index] ||= []).push($2.to_i) end @parsed += 1 end |