Class: ReadlineNG::ChunkedString
- Inherits:
-
Object
- Object
- ReadlineNG::ChunkedString
- Defined in:
- lib/readline-ng/chunked_string.rb
Instance Method Summary collapse
- #<<(str) ⇒ Object
- #each_chunk ⇒ Object
-
#initialize(str = "") ⇒ ChunkedString
constructor
A new instance of ChunkedString.
Constructor Details
#initialize(str = "") ⇒ ChunkedString
Returns a new instance of ChunkedString.
4 5 6 |
# File 'lib/readline-ng/chunked_string.rb', line 4 def initialize(str="") @buf = str end |
Instance Method Details
#<<(str) ⇒ Object
8 9 10 |
# File 'lib/readline-ng/chunked_string.rb', line 8 def <<(str) @buf += str end |
#each_chunk ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/readline-ng/chunked_string.rb', line 12 def each_chunk until @buf.empty? t = @buf.slice!(0) if t == "\e" t += @buf.slice!(0..1) end yield t end end |