lib/docrb/spec/fixtures/logrb.rb
# Public: Dumps a given String or Array in the same format as `hexdump -C`.
Dumps a given String or Array in the same format as `hexdump -C`.
Dumps a given String or Array in the same format as ` hexdump - C ` .
def dump(log, data = nil, **fields)
    return if LEVELS[@level] > LEVELS[:debug]
    if data.nil?
      data = log
      log = nil
    end
    data = data.pack("C*") if data.is_a? Array
    dump = []
    padding = @format == :json ? "" : "        "
    Hexdump.dump(data, output: dump)
    dump.map! { |line| "#{padding}#{line.chomp}" }
    dump = dump.join("\n")
    if @format == :json
      fields[:dump] = dump
      dump = nil
    end
    wrap(:dump, log || "", nil, fields)
    write_output("#{dump}\n\n") unless dump.nil?
  end
def dump ( log , data = nil , ** fields ) return if LEVELS [ @level ] > LEVELS [ :debug ] if data . nil? data = log log = nil end data = data . pack ( "C*" ) if data . is_a? Array dump = [ ] padding = @format == :json ? "" : "        " Hexdump . dump ( data , output : dump ) dump . map! { | line | "#{padding}#{line.chomp}" } dump = dump . join ( "\n" ) if @format == :json fields [ :dump ] = dump dump = nil end wrap ( :dump , log || "" , nil , fields ) write_output ( "#{dump}\n\n" ) unless dump . nil? end
Public: Dumps a given String or Array in the same format as `hexdump -C`.
Public : Dumps a given String or Array in the same format as ` hexdump - C ` .
log
data
fields