Class: Gdbmish::Dump::Ascii::Appender
- Inherits:
-
Object
- Object
- Gdbmish::Dump::Ascii::Appender
- Defined in:
- lib/gdbmish/dump.rb
Overview
Note:
Users should not use this class directly, as it only represents the data part of an dump, without header and footer.
An instance of it gets yielded when using Ascii#dump(io) { |appender| }
Appends and counts #pushed data as ASCII dump format onto the given io
.
Instance Attribute Summary collapse
-
#count ⇒ Integer
readonly
The number of key/value pairs pushed.
Instance Method Summary collapse
-
#initialize(io) ⇒ Appender
constructor
A new instance of Appender.
-
#push(key, value) ⇒ Object
Push a key, value pair onto the dump.
Constructor Details
#initialize(io) ⇒ Appender
Returns a new instance of Appender.
25 26 27 28 |
# File 'lib/gdbmish/dump.rb', line 25 def initialize(io) @io = io @count = 0 end |
Instance Attribute Details
#count ⇒ Integer (readonly)
Returns The number of key/value pairs pushed.
22 23 24 |
# File 'lib/gdbmish/dump.rb', line 22 def count @count end |
Instance Method Details
#push(key, value) ⇒ Object
Push a key, value pair onto the dump
33 34 35 36 37 38 |
# File 'lib/gdbmish/dump.rb', line 33 def push(key, value) @count += 1 @io << dump_datum(key) @io << dump_datum(value) nil end |