Class: Gdbmish::Dump::Ascii
- Inherits:
-
Object
- Object
- Gdbmish::Dump::Ascii
- Defined in:
- lib/gdbmish/dump.rb
Overview
Dumping GDBM data as ASCII (aka default) format.
Defined Under Namespace
Classes: Appender
Constant Summary collapse
- GDBM_MAX_DUMP_LINE_LEN =
GDBM does not split base64 strings at 60 encoded characters (as defined by RFC 2045).
See
_GDBM_MAX_DUMP_LINE_LEN
in gdbmdefs.h 76
Instance Method Summary collapse
- #dump(io, data = nil) {|appender| ... } ⇒ Object
-
#initialize(file: nil, uid: nil, user: nil, gid: nil, group: nil, mode: nil) ⇒ Ascii
constructor
Builds a new Ascii format dumper.
Constructor Details
#initialize(file: nil, uid: nil, user: nil, gid: nil, group: nil, mode: nil) ⇒ Ascii
Builds a new Ascii format dumper
Dumping file information is optional.
- uid, user, gid, group and mode will only be used when file is given
- user will only be used when uid is given
- group will only be used when gid is given
74 75 76 77 78 79 80 81 |
# File 'lib/gdbmish/dump.rb', line 74 def initialize(file: nil, uid: nil, user: nil, gid: nil, group: nil, mode: nil) @file = file @uid = uid @user = user @gid = gid @group = group @mode = mode end |
Instance Method Details
#dump(io) ⇒ IO #dump(io, data) ⇒ IO #dump(io) {|appender| ... } ⇒ IO #dump(io, data) {|appender| ... } ⇒ IO
103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/gdbmish/dump.rb', line 103 def dump(io, data = nil, &block) appender = Appender.new(io) dump_header!(io) data&.each_pair do |k, v| appender.push(k.to_s, v.to_s) end yield appender if block (io, appender.count) io end |