Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/exe_root.../opt/alt/ruby30/share/ruby
File: pp.rb
# frozen_string_literal: true
[0] Fix | Delete
[1] Fix | Delete
require 'prettyprint'
[2] Fix | Delete
[3] Fix | Delete
##
[4] Fix | Delete
# A pretty-printer for Ruby objects.
[5] Fix | Delete
#
[6] Fix | Delete
##
[7] Fix | Delete
# == What PP Does
[8] Fix | Delete
#
[9] Fix | Delete
# Standard output by #p returns this:
[10] Fix | Delete
# #<PP:0x81fedf0 @genspace=#<Proc:0x81feda0>, @group_queue=#<PrettyPrint::GroupQueue:0x81fed3c @queue=[[#<PrettyPrint::Group:0x81fed78 @breakables=[], @depth=0, @break=false>], []]>, @buffer=[], @newline="\n", @group_stack=[#<PrettyPrint::Group:0x81fed78 @breakables=[], @depth=0, @break=false>], @buffer_width=0, @indent=0, @maxwidth=79, @output_width=2, @output=#<IO:0x8114ee4>>
[11] Fix | Delete
#
[12] Fix | Delete
# Pretty-printed output returns this:
[13] Fix | Delete
# #<PP:0x81fedf0
[14] Fix | Delete
# @buffer=[],
[15] Fix | Delete
# @buffer_width=0,
[16] Fix | Delete
# @genspace=#<Proc:0x81feda0>,
[17] Fix | Delete
# @group_queue=
[18] Fix | Delete
# #<PrettyPrint::GroupQueue:0x81fed3c
[19] Fix | Delete
# @queue=
[20] Fix | Delete
# [[#<PrettyPrint::Group:0x81fed78 @break=false, @breakables=[], @depth=0>],
[21] Fix | Delete
# []]>,
[22] Fix | Delete
# @group_stack=
[23] Fix | Delete
# [#<PrettyPrint::Group:0x81fed78 @break=false, @breakables=[], @depth=0>],
[24] Fix | Delete
# @indent=0,
[25] Fix | Delete
# @maxwidth=79,
[26] Fix | Delete
# @newline="\n",
[27] Fix | Delete
# @output=#<IO:0x8114ee4>,
[28] Fix | Delete
# @output_width=2>
[29] Fix | Delete
#
[30] Fix | Delete
##
[31] Fix | Delete
# == Usage
[32] Fix | Delete
#
[33] Fix | Delete
# pp(obj) #=> obj
[34] Fix | Delete
# pp obj #=> obj
[35] Fix | Delete
# pp(obj1, obj2, ...) #=> [obj1, obj2, ...]
[36] Fix | Delete
# pp() #=> nil
[37] Fix | Delete
#
[38] Fix | Delete
# Output <tt>obj(s)</tt> to <tt>$></tt> in pretty printed format.
[39] Fix | Delete
#
[40] Fix | Delete
# It returns <tt>obj(s)</tt>.
[41] Fix | Delete
#
[42] Fix | Delete
##
[43] Fix | Delete
# == Output Customization
[44] Fix | Delete
#
[45] Fix | Delete
# To define a customized pretty printing function for your classes,
[46] Fix | Delete
# redefine method <code>#pretty_print(pp)</code> in the class.
[47] Fix | Delete
#
[48] Fix | Delete
# <code>#pretty_print</code> takes the +pp+ argument, which is an instance of the PP class.
[49] Fix | Delete
# The method uses #text, #breakable, #nest, #group and #pp to print the
[50] Fix | Delete
# object.
[51] Fix | Delete
#
[52] Fix | Delete
##
[53] Fix | Delete
# == Pretty-Print JSON
[54] Fix | Delete
#
[55] Fix | Delete
# To pretty-print JSON refer to JSON#pretty_generate.
[56] Fix | Delete
#
[57] Fix | Delete
##
[58] Fix | Delete
# == Author
[59] Fix | Delete
# Tanaka Akira <akr@fsij.org>
[60] Fix | Delete
[61] Fix | Delete
class PP < PrettyPrint
[62] Fix | Delete
# Outputs +obj+ to +out+ in pretty printed format of
[63] Fix | Delete
# +width+ columns in width.
[64] Fix | Delete
#
[65] Fix | Delete
# If +out+ is omitted, <code>$></code> is assumed.
[66] Fix | Delete
# If +width+ is omitted, 79 is assumed.
[67] Fix | Delete
#
[68] Fix | Delete
# PP.pp returns +out+.
[69] Fix | Delete
def PP.pp(obj, out=$>, width=79)
[70] Fix | Delete
q = PP.new(out, width)
[71] Fix | Delete
q.guard_inspect_key {q.pp obj}
[72] Fix | Delete
q.flush
[73] Fix | Delete
#$pp = q
[74] Fix | Delete
out << "\n"
[75] Fix | Delete
end
[76] Fix | Delete
[77] Fix | Delete
# Outputs +obj+ to +out+ like PP.pp but with no indent and
[78] Fix | Delete
# newline.
[79] Fix | Delete
#
[80] Fix | Delete
# PP.singleline_pp returns +out+.
[81] Fix | Delete
def PP.singleline_pp(obj, out=$>)
[82] Fix | Delete
q = SingleLine.new(out)
[83] Fix | Delete
q.guard_inspect_key {q.pp obj}
[84] Fix | Delete
q.flush
[85] Fix | Delete
out
[86] Fix | Delete
end
[87] Fix | Delete
[88] Fix | Delete
# :stopdoc:
[89] Fix | Delete
def PP.mcall(obj, mod, meth, *args, &block)
[90] Fix | Delete
mod.instance_method(meth).bind_call(obj, *args, &block)
[91] Fix | Delete
end
[92] Fix | Delete
# :startdoc:
[93] Fix | Delete
[94] Fix | Delete
if defined? ::Ractor
[95] Fix | Delete
class << self
[96] Fix | Delete
# Returns the sharing detection flag as a boolean value.
[97] Fix | Delete
# It is false (nil) by default.
[98] Fix | Delete
def sharing_detection
[99] Fix | Delete
Ractor.current[:pp_sharing_detection]
[100] Fix | Delete
end
[101] Fix | Delete
# Sets the sharing detection flag to b.
[102] Fix | Delete
def sharing_detection=(b)
[103] Fix | Delete
Ractor.current[:pp_sharing_detection] = b
[104] Fix | Delete
end
[105] Fix | Delete
end
[106] Fix | Delete
else
[107] Fix | Delete
@sharing_detection = false
[108] Fix | Delete
class << self
[109] Fix | Delete
# Returns the sharing detection flag as a boolean value.
[110] Fix | Delete
# It is false by default.
[111] Fix | Delete
attr_accessor :sharing_detection
[112] Fix | Delete
end
[113] Fix | Delete
end
[114] Fix | Delete
[115] Fix | Delete
module PPMethods
[116] Fix | Delete
[117] Fix | Delete
# Yields to a block
[118] Fix | Delete
# and preserves the previous set of objects being printed.
[119] Fix | Delete
def guard_inspect_key
[120] Fix | Delete
if Thread.current[:__recursive_key__] == nil
[121] Fix | Delete
Thread.current[:__recursive_key__] = {}.compare_by_identity
[122] Fix | Delete
end
[123] Fix | Delete
[124] Fix | Delete
if Thread.current[:__recursive_key__][:inspect] == nil
[125] Fix | Delete
Thread.current[:__recursive_key__][:inspect] = {}.compare_by_identity
[126] Fix | Delete
end
[127] Fix | Delete
[128] Fix | Delete
save = Thread.current[:__recursive_key__][:inspect]
[129] Fix | Delete
[130] Fix | Delete
begin
[131] Fix | Delete
Thread.current[:__recursive_key__][:inspect] = {}.compare_by_identity
[132] Fix | Delete
yield
[133] Fix | Delete
ensure
[134] Fix | Delete
Thread.current[:__recursive_key__][:inspect] = save
[135] Fix | Delete
end
[136] Fix | Delete
end
[137] Fix | Delete
[138] Fix | Delete
# Check whether the object_id +id+ is in the current buffer of objects
[139] Fix | Delete
# to be pretty printed. Used to break cycles in chains of objects to be
[140] Fix | Delete
# pretty printed.
[141] Fix | Delete
def check_inspect_key(id)
[142] Fix | Delete
Thread.current[:__recursive_key__] &&
[143] Fix | Delete
Thread.current[:__recursive_key__][:inspect] &&
[144] Fix | Delete
Thread.current[:__recursive_key__][:inspect].include?(id)
[145] Fix | Delete
end
[146] Fix | Delete
[147] Fix | Delete
# Adds the object_id +id+ to the set of objects being pretty printed, so
[148] Fix | Delete
# as to not repeat objects.
[149] Fix | Delete
def push_inspect_key(id)
[150] Fix | Delete
Thread.current[:__recursive_key__][:inspect][id] = true
[151] Fix | Delete
end
[152] Fix | Delete
[153] Fix | Delete
# Removes an object from the set of objects being pretty printed.
[154] Fix | Delete
def pop_inspect_key(id)
[155] Fix | Delete
Thread.current[:__recursive_key__][:inspect].delete id
[156] Fix | Delete
end
[157] Fix | Delete
[158] Fix | Delete
# Adds +obj+ to the pretty printing buffer
[159] Fix | Delete
# using Object#pretty_print or Object#pretty_print_cycle.
[160] Fix | Delete
#
[161] Fix | Delete
# Object#pretty_print_cycle is used when +obj+ is already
[162] Fix | Delete
# printed, a.k.a the object reference chain has a cycle.
[163] Fix | Delete
def pp(obj)
[164] Fix | Delete
# If obj is a Delegator then use the object being delegated to for cycle
[165] Fix | Delete
# detection
[166] Fix | Delete
obj = obj.__getobj__ if defined?(::Delegator) and obj.is_a?(::Delegator)
[167] Fix | Delete
[168] Fix | Delete
if check_inspect_key(obj)
[169] Fix | Delete
group {obj.pretty_print_cycle self}
[170] Fix | Delete
return
[171] Fix | Delete
end
[172] Fix | Delete
[173] Fix | Delete
begin
[174] Fix | Delete
push_inspect_key(obj)
[175] Fix | Delete
group {obj.pretty_print self}
[176] Fix | Delete
ensure
[177] Fix | Delete
pop_inspect_key(obj) unless PP.sharing_detection
[178] Fix | Delete
end
[179] Fix | Delete
end
[180] Fix | Delete
[181] Fix | Delete
# A convenience method which is same as follows:
[182] Fix | Delete
#
[183] Fix | Delete
# group(1, '#<' + obj.class.name, '>') { ... }
[184] Fix | Delete
def object_group(obj, &block) # :yield:
[185] Fix | Delete
group(1, '#<' + obj.class.name, '>', &block)
[186] Fix | Delete
end
[187] Fix | Delete
[188] Fix | Delete
# A convenience method, like object_group, but also reformats the Object's
[189] Fix | Delete
# object_id.
[190] Fix | Delete
def object_address_group(obj, &block)
[191] Fix | Delete
str = Kernel.instance_method(:to_s).bind_call(obj)
[192] Fix | Delete
str.chomp!('>')
[193] Fix | Delete
group(1, str, '>', &block)
[194] Fix | Delete
end
[195] Fix | Delete
[196] Fix | Delete
# A convenience method which is same as follows:
[197] Fix | Delete
#
[198] Fix | Delete
# text ','
[199] Fix | Delete
# breakable
[200] Fix | Delete
def comma_breakable
[201] Fix | Delete
text ','
[202] Fix | Delete
breakable
[203] Fix | Delete
end
[204] Fix | Delete
[205] Fix | Delete
# Adds a separated list.
[206] Fix | Delete
# The list is separated by comma with breakable space, by default.
[207] Fix | Delete
#
[208] Fix | Delete
# #seplist iterates the +list+ using +iter_method+.
[209] Fix | Delete
# It yields each object to the block given for #seplist.
[210] Fix | Delete
# The procedure +separator_proc+ is called between each yields.
[211] Fix | Delete
#
[212] Fix | Delete
# If the iteration is zero times, +separator_proc+ is not called at all.
[213] Fix | Delete
#
[214] Fix | Delete
# If +separator_proc+ is nil or not given,
[215] Fix | Delete
# +lambda { comma_breakable }+ is used.
[216] Fix | Delete
# If +iter_method+ is not given, :each is used.
[217] Fix | Delete
#
[218] Fix | Delete
# For example, following 3 code fragments has similar effect.
[219] Fix | Delete
#
[220] Fix | Delete
# q.seplist([1,2,3]) {|v| xxx v }
[221] Fix | Delete
#
[222] Fix | Delete
# q.seplist([1,2,3], lambda { q.comma_breakable }, :each) {|v| xxx v }
[223] Fix | Delete
#
[224] Fix | Delete
# xxx 1
[225] Fix | Delete
# q.comma_breakable
[226] Fix | Delete
# xxx 2
[227] Fix | Delete
# q.comma_breakable
[228] Fix | Delete
# xxx 3
[229] Fix | Delete
def seplist(list, sep=nil, iter_method=:each) # :yield: element
[230] Fix | Delete
sep ||= lambda { comma_breakable }
[231] Fix | Delete
first = true
[232] Fix | Delete
list.__send__(iter_method) {|*v|
[233] Fix | Delete
if first
[234] Fix | Delete
first = false
[235] Fix | Delete
else
[236] Fix | Delete
sep.call
[237] Fix | Delete
end
[238] Fix | Delete
RUBY_VERSION >= "3.0" ? yield(*v, **{}) : yield(*v)
[239] Fix | Delete
}
[240] Fix | Delete
end
[241] Fix | Delete
[242] Fix | Delete
# A present standard failsafe for pretty printing any given Object
[243] Fix | Delete
def pp_object(obj)
[244] Fix | Delete
object_address_group(obj) {
[245] Fix | Delete
seplist(obj.pretty_print_instance_variables, lambda { text ',' }) {|v|
[246] Fix | Delete
breakable
[247] Fix | Delete
v = v.to_s if Symbol === v
[248] Fix | Delete
text v
[249] Fix | Delete
text '='
[250] Fix | Delete
group(1) {
[251] Fix | Delete
breakable ''
[252] Fix | Delete
pp(obj.instance_eval(v))
[253] Fix | Delete
}
[254] Fix | Delete
}
[255] Fix | Delete
}
[256] Fix | Delete
end
[257] Fix | Delete
[258] Fix | Delete
# A pretty print for a Hash
[259] Fix | Delete
def pp_hash(obj)
[260] Fix | Delete
group(1, '{', '}') {
[261] Fix | Delete
seplist(obj, nil, :each_pair) {|k, v|
[262] Fix | Delete
group {
[263] Fix | Delete
pp k
[264] Fix | Delete
text '=>'
[265] Fix | Delete
group(1) {
[266] Fix | Delete
breakable ''
[267] Fix | Delete
pp v
[268] Fix | Delete
}
[269] Fix | Delete
}
[270] Fix | Delete
}
[271] Fix | Delete
}
[272] Fix | Delete
end
[273] Fix | Delete
end
[274] Fix | Delete
[275] Fix | Delete
include PPMethods
[276] Fix | Delete
[277] Fix | Delete
class SingleLine < PrettyPrint::SingleLine # :nodoc:
[278] Fix | Delete
include PPMethods
[279] Fix | Delete
end
[280] Fix | Delete
[281] Fix | Delete
module ObjectMixin # :nodoc:
[282] Fix | Delete
# 1. specific pretty_print
[283] Fix | Delete
# 2. specific inspect
[284] Fix | Delete
# 3. generic pretty_print
[285] Fix | Delete
[286] Fix | Delete
# A default pretty printing method for general objects.
[287] Fix | Delete
# It calls #pretty_print_instance_variables to list instance variables.
[288] Fix | Delete
#
[289] Fix | Delete
# If +self+ has a customized (redefined) #inspect method,
[290] Fix | Delete
# the result of self.inspect is used but it obviously has no
[291] Fix | Delete
# line break hints.
[292] Fix | Delete
#
[293] Fix | Delete
# This module provides predefined #pretty_print methods for some of
[294] Fix | Delete
# the most commonly used built-in classes for convenience.
[295] Fix | Delete
def pretty_print(q)
[296] Fix | Delete
umethod_method = Object.instance_method(:method)
[297] Fix | Delete
begin
[298] Fix | Delete
inspect_method = umethod_method.bind_call(self, :inspect)
[299] Fix | Delete
rescue NameError
[300] Fix | Delete
end
[301] Fix | Delete
if inspect_method && inspect_method.owner != Kernel
[302] Fix | Delete
q.text self.inspect
[303] Fix | Delete
elsif !inspect_method && self.respond_to?(:inspect)
[304] Fix | Delete
q.text self.inspect
[305] Fix | Delete
else
[306] Fix | Delete
q.pp_object(self)
[307] Fix | Delete
end
[308] Fix | Delete
end
[309] Fix | Delete
[310] Fix | Delete
# A default pretty printing method for general objects that are
[311] Fix | Delete
# detected as part of a cycle.
[312] Fix | Delete
def pretty_print_cycle(q)
[313] Fix | Delete
q.object_address_group(self) {
[314] Fix | Delete
q.breakable
[315] Fix | Delete
q.text '...'
[316] Fix | Delete
}
[317] Fix | Delete
end
[318] Fix | Delete
[319] Fix | Delete
# Returns a sorted array of instance variable names.
[320] Fix | Delete
#
[321] Fix | Delete
# This method should return an array of names of instance variables as symbols or strings as:
[322] Fix | Delete
# +[:@a, :@b]+.
[323] Fix | Delete
def pretty_print_instance_variables
[324] Fix | Delete
instance_variables.sort
[325] Fix | Delete
end
[326] Fix | Delete
[327] Fix | Delete
# Is #inspect implementation using #pretty_print.
[328] Fix | Delete
# If you implement #pretty_print, it can be used as follows.
[329] Fix | Delete
#
[330] Fix | Delete
# alias inspect pretty_print_inspect
[331] Fix | Delete
#
[332] Fix | Delete
# However, doing this requires that every class that #inspect is called on
[333] Fix | Delete
# implement #pretty_print, or a RuntimeError will be raised.
[334] Fix | Delete
def pretty_print_inspect
[335] Fix | Delete
if Object.instance_method(:method).bind_call(self, :pretty_print).owner == PP::ObjectMixin
[336] Fix | Delete
raise "pretty_print is not overridden for #{self.class}"
[337] Fix | Delete
end
[338] Fix | Delete
PP.singleline_pp(self, ''.dup)
[339] Fix | Delete
end
[340] Fix | Delete
end
[341] Fix | Delete
end
[342] Fix | Delete
[343] Fix | Delete
class Array # :nodoc:
[344] Fix | Delete
def pretty_print(q) # :nodoc:
[345] Fix | Delete
q.group(1, '[', ']') {
[346] Fix | Delete
q.seplist(self) {|v|
[347] Fix | Delete
q.pp v
[348] Fix | Delete
}
[349] Fix | Delete
}
[350] Fix | Delete
end
[351] Fix | Delete
[352] Fix | Delete
def pretty_print_cycle(q) # :nodoc:
[353] Fix | Delete
q.text(empty? ? '[]' : '[...]')
[354] Fix | Delete
end
[355] Fix | Delete
end
[356] Fix | Delete
[357] Fix | Delete
class Hash # :nodoc:
[358] Fix | Delete
def pretty_print(q) # :nodoc:
[359] Fix | Delete
q.pp_hash self
[360] Fix | Delete
end
[361] Fix | Delete
[362] Fix | Delete
def pretty_print_cycle(q) # :nodoc:
[363] Fix | Delete
q.text(empty? ? '{}' : '{...}')
[364] Fix | Delete
end
[365] Fix | Delete
end
[366] Fix | Delete
[367] Fix | Delete
class << ENV # :nodoc:
[368] Fix | Delete
def pretty_print(q) # :nodoc:
[369] Fix | Delete
h = {}
[370] Fix | Delete
ENV.keys.sort.each {|k|
[371] Fix | Delete
h[k] = ENV[k]
[372] Fix | Delete
}
[373] Fix | Delete
q.pp_hash h
[374] Fix | Delete
end
[375] Fix | Delete
end
[376] Fix | Delete
[377] Fix | Delete
class Struct # :nodoc:
[378] Fix | Delete
def pretty_print(q) # :nodoc:
[379] Fix | Delete
q.group(1, sprintf("#<struct %s", PP.mcall(self, Kernel, :class).name), '>') {
[380] Fix | Delete
q.seplist(PP.mcall(self, Struct, :members), lambda { q.text "," }) {|member|
[381] Fix | Delete
q.breakable
[382] Fix | Delete
q.text member.to_s
[383] Fix | Delete
q.text '='
[384] Fix | Delete
q.group(1) {
[385] Fix | Delete
q.breakable ''
[386] Fix | Delete
q.pp self[member]
[387] Fix | Delete
}
[388] Fix | Delete
}
[389] Fix | Delete
}
[390] Fix | Delete
end
[391] Fix | Delete
[392] Fix | Delete
def pretty_print_cycle(q) # :nodoc:
[393] Fix | Delete
q.text sprintf("#<struct %s:...>", PP.mcall(self, Kernel, :class).name)
[394] Fix | Delete
end
[395] Fix | Delete
end
[396] Fix | Delete
[397] Fix | Delete
class Range # :nodoc:
[398] Fix | Delete
def pretty_print(q) # :nodoc:
[399] Fix | Delete
q.pp self.begin
[400] Fix | Delete
q.breakable ''
[401] Fix | Delete
q.text(self.exclude_end? ? '...' : '..')
[402] Fix | Delete
q.breakable ''
[403] Fix | Delete
q.pp self.end if self.end
[404] Fix | Delete
end
[405] Fix | Delete
end
[406] Fix | Delete
[407] Fix | Delete
class String # :nodoc:
[408] Fix | Delete
def pretty_print(q) # :nodoc:
[409] Fix | Delete
lines = self.lines
[410] Fix | Delete
if lines.size > 1
[411] Fix | Delete
q.group(0, '', '') do
[412] Fix | Delete
q.seplist(lines, lambda { q.text ' +'; q.breakable }) do |v|
[413] Fix | Delete
q.pp v
[414] Fix | Delete
end
[415] Fix | Delete
end
[416] Fix | Delete
else
[417] Fix | Delete
q.text inspect
[418] Fix | Delete
end
[419] Fix | Delete
end
[420] Fix | Delete
end
[421] Fix | Delete
[422] Fix | Delete
class File < IO # :nodoc:
[423] Fix | Delete
class Stat # :nodoc:
[424] Fix | Delete
def pretty_print(q) # :nodoc:
[425] Fix | Delete
require 'etc.so'
[426] Fix | Delete
q.object_group(self) {
[427] Fix | Delete
q.breakable
[428] Fix | Delete
q.text sprintf("dev=0x%x", self.dev); q.comma_breakable
[429] Fix | Delete
q.text "ino="; q.pp self.ino; q.comma_breakable
[430] Fix | Delete
q.group {
[431] Fix | Delete
m = self.mode
[432] Fix | Delete
q.text sprintf("mode=0%o", m)
[433] Fix | Delete
q.breakable
[434] Fix | Delete
q.text sprintf("(%s %c%c%c%c%c%c%c%c%c)",
[435] Fix | Delete
self.ftype,
[436] Fix | Delete
(m & 0400 == 0 ? ?- : ?r),
[437] Fix | Delete
(m & 0200 == 0 ? ?- : ?w),
[438] Fix | Delete
(m & 0100 == 0 ? (m & 04000 == 0 ? ?- : ?S) :
[439] Fix | Delete
(m & 04000 == 0 ? ?x : ?s)),
[440] Fix | Delete
(m & 0040 == 0 ? ?- : ?r),
[441] Fix | Delete
(m & 0020 == 0 ? ?- : ?w),
[442] Fix | Delete
(m & 0010 == 0 ? (m & 02000 == 0 ? ?- : ?S) :
[443] Fix | Delete
(m & 02000 == 0 ? ?x : ?s)),
[444] Fix | Delete
(m & 0004 == 0 ? ?- : ?r),
[445] Fix | Delete
(m & 0002 == 0 ? ?- : ?w),
[446] Fix | Delete
(m & 0001 == 0 ? (m & 01000 == 0 ? ?- : ?T) :
[447] Fix | Delete
(m & 01000 == 0 ? ?x : ?t)))
[448] Fix | Delete
}
[449] Fix | Delete
q.comma_breakable
[450] Fix | Delete
q.text "nlink="; q.pp self.nlink; q.comma_breakable
[451] Fix | Delete
q.group {
[452] Fix | Delete
q.text "uid="; q.pp self.uid
[453] Fix | Delete
begin
[454] Fix | Delete
pw = Etc.getpwuid(self.uid)
[455] Fix | Delete
rescue ArgumentError
[456] Fix | Delete
end
[457] Fix | Delete
if pw
[458] Fix | Delete
q.breakable; q.text "(#{pw.name})"
[459] Fix | Delete
end
[460] Fix | Delete
}
[461] Fix | Delete
q.comma_breakable
[462] Fix | Delete
q.group {
[463] Fix | Delete
q.text "gid="; q.pp self.gid
[464] Fix | Delete
begin
[465] Fix | Delete
gr = Etc.getgrgid(self.gid)
[466] Fix | Delete
rescue ArgumentError
[467] Fix | Delete
end
[468] Fix | Delete
if gr
[469] Fix | Delete
q.breakable; q.text "(#{gr.name})"
[470] Fix | Delete
end
[471] Fix | Delete
}
[472] Fix | Delete
q.comma_breakable
[473] Fix | Delete
q.group {
[474] Fix | Delete
q.text sprintf("rdev=0x%x", self.rdev)
[475] Fix | Delete
if self.rdev_major && self.rdev_minor
[476] Fix | Delete
q.breakable
[477] Fix | Delete
q.text sprintf('(%d, %d)', self.rdev_major, self.rdev_minor)
[478] Fix | Delete
end
[479] Fix | Delete
}
[480] Fix | Delete
q.comma_breakable
[481] Fix | Delete
q.text "size="; q.pp self.size; q.comma_breakable
[482] Fix | Delete
q.text "blksize="; q.pp self.blksize; q.comma_breakable
[483] Fix | Delete
q.text "blocks="; q.pp self.blocks; q.comma_breakable
[484] Fix | Delete
q.group {
[485] Fix | Delete
t = self.atime
[486] Fix | Delete
q.text "atime="; q.pp t
[487] Fix | Delete
q.breakable; q.text "(#{t.tv_sec})"
[488] Fix | Delete
}
[489] Fix | Delete
q.comma_breakable
[490] Fix | Delete
q.group {
[491] Fix | Delete
t = self.mtime
[492] Fix | Delete
q.text "mtime="; q.pp t
[493] Fix | Delete
q.breakable; q.text "(#{t.tv_sec})"
[494] Fix | Delete
}
[495] Fix | Delete
q.comma_breakable
[496] Fix | Delete
q.group {
[497] Fix | Delete
t = self.ctime
[498] Fix | Delete
q.text "ctime="; q.pp t
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function