Class: Okura::Words::CompactStringArray::Builder
- Inherits:
-
Object
- Object
- Okura::Words::CompactStringArray::Builder
- Defined in:
- lib/okura.rb
Instance Method Summary collapse
- #add(surface) ⇒ Object
- #build ⇒ Object
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize ⇒ Builder
Returns a new instance of Builder.
123 124 125 126 127 |
# File 'lib/okura.rb', line 123 def initialize @indices=[] @surfaces=[] @size=0 end |
Instance Method Details
#add(surface) ⇒ Object
131 132 133 134 135 136 137 |
# File 'lib/okura.rb', line 131 def add surface id=@indices.length @indices.push @size @surfaces.push surface @size+=surface.bytesize id end |
#build ⇒ Object
128 129 130 |
# File 'lib/okura.rb', line 128 def build Okura::Words::CompactStringArray.new @surfaces.join(''),@indices end |