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