struct Gdbmish::Dump::Ascii

Defined in:

gdbmish/dump.cr

Constant Summary

GDBM_MAX_DUMP_LINE_LEN = 76

GDBMs does not split base64 strings at 60 encoded characters (as defined by RFC 2045). See gdbmdefs.h

Constructors

Instance Method Summary

Constructor Detail

def self.new(file : String | Nil = nil, uid : String | Nil = nil, user : String | Nil = nil, gid : String | Nil = nil, group : String | Nil = nil, mode : Int32 | Nil = nil) #

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

Example:

fileoptions = {file: "test.db", uid: "1000", user: "ziggy", gid: "1000", group: "staff", mode: 0o600}
File.open("test.dump", "w") do |file|
  Gdbmish::Dump::Ascii.new(**fileoptions).dump(file) do |appender|
    MyDataSource.each do |key, value|
      appender << {key.to_s, value.to_s}
    end
  end
end

[View source]

Instance Method Detail

def dump(io : IO, & : Appender -> _) : IO #

[View source]
def dump(io : IO, data : Hash | NamedTuple) : IO #

[View source]