Module: Gdbmish::Dump
- Defined in:
- lib/gdbmish/dump.rb
Overview
Wrapper for different dump formats, providing various shortcut methods.
Currently, there is only Ascii
mode.
Ascii mode optionally dumps file information such as filename, owner, mode. See Ascii#new on how they are used.
Defined Under Namespace
Classes: Ascii
Class Method Summary collapse
-
.ascii(data = nil, io = nil, **fileoptions) {|appender| ... } ⇒ String, IO
Dump data as standard ASCII format.
Class Method Details
.ascii(data = nil, io = nil, **fileoptions) {|appender| ... } ⇒ String, IO
Dump data as standard ASCII format.
When an io is given, the dump will be written to it. Otherwise, a new String
will be returned.
See Gdbmish::Dump::Ascii#initialize for fileoptions.
See Gdbmish::Dump::Ascii#dump for data and block behaviour.
180 181 182 183 184 185 186 187 188 |
# File 'lib/gdbmish/dump.rb', line 180 def self.ascii(data = nil, io = nil, **, &block) if io.nil? io = StringIO.new to_string = true end io = Ascii.new(**).dump(io, data, &block) to_string ? io.string : io end |