Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../proc/self/root/usr/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(obj).call(*args, &block)
[91] Fix | Delete
end
[92] Fix | Delete
# :startdoc:
[93] Fix | Delete
[94] Fix | Delete
@sharing_detection = false
[95] Fix | Delete
class << self
[96] Fix | Delete
# Returns the sharing detection flag as a boolean value.
[97] Fix | Delete
# It is false by default.
[98] Fix | Delete
attr_accessor :sharing_detection
[99] Fix | Delete
end
[100] Fix | Delete
[101] Fix | Delete
module PPMethods
[102] Fix | Delete
[103] Fix | Delete
# Yields to a block
[104] Fix | Delete
# and preserves the previous set of objects being printed.
[105] Fix | Delete
def guard_inspect_key
[106] Fix | Delete
if Thread.current[:__recursive_key__] == nil
[107] Fix | Delete
Thread.current[:__recursive_key__] = {}.taint
[108] Fix | Delete
end
[109] Fix | Delete
[110] Fix | Delete
if Thread.current[:__recursive_key__][:inspect] == nil
[111] Fix | Delete
Thread.current[:__recursive_key__][:inspect] = {}.taint
[112] Fix | Delete
end
[113] Fix | Delete
[114] Fix | Delete
save = Thread.current[:__recursive_key__][:inspect]
[115] Fix | Delete
[116] Fix | Delete
begin
[117] Fix | Delete
Thread.current[:__recursive_key__][:inspect] = {}.taint
[118] Fix | Delete
yield
[119] Fix | Delete
ensure
[120] Fix | Delete
Thread.current[:__recursive_key__][:inspect] = save
[121] Fix | Delete
end
[122] Fix | Delete
end
[123] Fix | Delete
[124] Fix | Delete
# Check whether the object_id +id+ is in the current buffer of objects
[125] Fix | Delete
# to be pretty printed. Used to break cycles in chains of objects to be
[126] Fix | Delete
# pretty printed.
[127] Fix | Delete
def check_inspect_key(id)
[128] Fix | Delete
Thread.current[:__recursive_key__] &&
[129] Fix | Delete
Thread.current[:__recursive_key__][:inspect] &&
[130] Fix | Delete
Thread.current[:__recursive_key__][:inspect].include?(id)
[131] Fix | Delete
end
[132] Fix | Delete
[133] Fix | Delete
# Adds the object_id +id+ to the set of objects being pretty printed, so
[134] Fix | Delete
# as to not repeat objects.
[135] Fix | Delete
def push_inspect_key(id)
[136] Fix | Delete
Thread.current[:__recursive_key__][:inspect][id] = true
[137] Fix | Delete
end
[138] Fix | Delete
[139] Fix | Delete
# Removes an object from the set of objects being pretty printed.
[140] Fix | Delete
def pop_inspect_key(id)
[141] Fix | Delete
Thread.current[:__recursive_key__][:inspect].delete id
[142] Fix | Delete
end
[143] Fix | Delete
[144] Fix | Delete
# Adds +obj+ to the pretty printing buffer
[145] Fix | Delete
# using Object#pretty_print or Object#pretty_print_cycle.
[146] Fix | Delete
#
[147] Fix | Delete
# Object#pretty_print_cycle is used when +obj+ is already
[148] Fix | Delete
# printed, a.k.a the object reference chain has a cycle.
[149] Fix | Delete
def pp(obj)
[150] Fix | Delete
id = obj.object_id
[151] Fix | Delete
[152] Fix | Delete
if check_inspect_key(id)
[153] Fix | Delete
group {obj.pretty_print_cycle self}
[154] Fix | Delete
return
[155] Fix | Delete
end
[156] Fix | Delete
[157] Fix | Delete
begin
[158] Fix | Delete
push_inspect_key(id)
[159] Fix | Delete
group {obj.pretty_print self}
[160] Fix | Delete
ensure
[161] Fix | Delete
pop_inspect_key(id) unless PP.sharing_detection
[162] Fix | Delete
end
[163] Fix | Delete
end
[164] Fix | Delete
[165] Fix | Delete
# A convenience method which is same as follows:
[166] Fix | Delete
#
[167] Fix | Delete
# group(1, '#<' + obj.class.name, '>') { ... }
[168] Fix | Delete
def object_group(obj, &block) # :yield:
[169] Fix | Delete
group(1, '#<' + obj.class.name, '>', &block)
[170] Fix | Delete
end
[171] Fix | Delete
[172] Fix | Delete
# A convenience method, like object_group, but also reformats the Object's
[173] Fix | Delete
# object_id.
[174] Fix | Delete
def object_address_group(obj, &block)
[175] Fix | Delete
str = Kernel.instance_method(:to_s).bind(obj).call
[176] Fix | Delete
str.chomp!('>')
[177] Fix | Delete
group(1, str, '>', &block)
[178] Fix | Delete
end
[179] Fix | Delete
[180] Fix | Delete
# A convenience method which is same as follows:
[181] Fix | Delete
#
[182] Fix | Delete
# text ','
[183] Fix | Delete
# breakable
[184] Fix | Delete
def comma_breakable
[185] Fix | Delete
text ','
[186] Fix | Delete
breakable
[187] Fix | Delete
end
[188] Fix | Delete
[189] Fix | Delete
# Adds a separated list.
[190] Fix | Delete
# The list is separated by comma with breakable space, by default.
[191] Fix | Delete
#
[192] Fix | Delete
# #seplist iterates the +list+ using +iter_method+.
[193] Fix | Delete
# It yields each object to the block given for #seplist.
[194] Fix | Delete
# The procedure +separator_proc+ is called between each yields.
[195] Fix | Delete
#
[196] Fix | Delete
# If the iteration is zero times, +separator_proc+ is not called at all.
[197] Fix | Delete
#
[198] Fix | Delete
# If +separator_proc+ is nil or not given,
[199] Fix | Delete
# +lambda { comma_breakable }+ is used.
[200] Fix | Delete
# If +iter_method+ is not given, :each is used.
[201] Fix | Delete
#
[202] Fix | Delete
# For example, following 3 code fragments has similar effect.
[203] Fix | Delete
#
[204] Fix | Delete
# q.seplist([1,2,3]) {|v| xxx v }
[205] Fix | Delete
#
[206] Fix | Delete
# q.seplist([1,2,3], lambda { q.comma_breakable }, :each) {|v| xxx v }
[207] Fix | Delete
#
[208] Fix | Delete
# xxx 1
[209] Fix | Delete
# q.comma_breakable
[210] Fix | Delete
# xxx 2
[211] Fix | Delete
# q.comma_breakable
[212] Fix | Delete
# xxx 3
[213] Fix | Delete
def seplist(list, sep=nil, iter_method=:each) # :yield: element
[214] Fix | Delete
sep ||= lambda { comma_breakable }
[215] Fix | Delete
first = true
[216] Fix | Delete
list.__send__(iter_method) {|*v|
[217] Fix | Delete
if first
[218] Fix | Delete
first = false
[219] Fix | Delete
else
[220] Fix | Delete
sep.call
[221] Fix | Delete
end
[222] Fix | Delete
yield(*v)
[223] Fix | Delete
}
[224] Fix | Delete
end
[225] Fix | Delete
[226] Fix | Delete
# A present standard failsafe for pretty printing any given Object
[227] Fix | Delete
def pp_object(obj)
[228] Fix | Delete
object_address_group(obj) {
[229] Fix | Delete
seplist(obj.pretty_print_instance_variables, lambda { text ',' }) {|v|
[230] Fix | Delete
breakable
[231] Fix | Delete
v = v.to_s if Symbol === v
[232] Fix | Delete
text v
[233] Fix | Delete
text '='
[234] Fix | Delete
group(1) {
[235] Fix | Delete
breakable ''
[236] Fix | Delete
pp(obj.instance_eval(v))
[237] Fix | Delete
}
[238] Fix | Delete
}
[239] Fix | Delete
}
[240] Fix | Delete
end
[241] Fix | Delete
[242] Fix | Delete
# A pretty print for a Hash
[243] Fix | Delete
def pp_hash(obj)
[244] Fix | Delete
group(1, '{', '}') {
[245] Fix | Delete
seplist(obj, nil, :each_pair) {|k, v|
[246] Fix | Delete
group {
[247] Fix | Delete
pp k
[248] Fix | Delete
text '=>'
[249] Fix | Delete
group(1) {
[250] Fix | Delete
breakable ''
[251] Fix | Delete
pp v
[252] Fix | Delete
}
[253] Fix | Delete
}
[254] Fix | Delete
}
[255] Fix | Delete
}
[256] Fix | Delete
end
[257] Fix | Delete
end
[258] Fix | Delete
[259] Fix | Delete
include PPMethods
[260] Fix | Delete
[261] Fix | Delete
class SingleLine < PrettyPrint::SingleLine # :nodoc:
[262] Fix | Delete
include PPMethods
[263] Fix | Delete
end
[264] Fix | Delete
[265] Fix | Delete
module ObjectMixin # :nodoc:
[266] Fix | Delete
# 1. specific pretty_print
[267] Fix | Delete
# 2. specific inspect
[268] Fix | Delete
# 3. generic pretty_print
[269] Fix | Delete
[270] Fix | Delete
# A default pretty printing method for general objects.
[271] Fix | Delete
# It calls #pretty_print_instance_variables to list instance variables.
[272] Fix | Delete
#
[273] Fix | Delete
# If +self+ has a customized (redefined) #inspect method,
[274] Fix | Delete
# the result of self.inspect is used but it obviously has no
[275] Fix | Delete
# line break hints.
[276] Fix | Delete
#
[277] Fix | Delete
# This module provides predefined #pretty_print methods for some of
[278] Fix | Delete
# the most commonly used built-in classes for convenience.
[279] Fix | Delete
def pretty_print(q)
[280] Fix | Delete
method_method = Object.instance_method(:method).bind(self)
[281] Fix | Delete
begin
[282] Fix | Delete
inspect_method = method_method.call(:inspect)
[283] Fix | Delete
rescue NameError
[284] Fix | Delete
end
[285] Fix | Delete
if inspect_method && inspect_method.owner != Kernel
[286] Fix | Delete
q.text self.inspect
[287] Fix | Delete
elsif !inspect_method && self.respond_to?(:inspect)
[288] Fix | Delete
q.text self.inspect
[289] Fix | Delete
else
[290] Fix | Delete
q.pp_object(self)
[291] Fix | Delete
end
[292] Fix | Delete
end
[293] Fix | Delete
[294] Fix | Delete
# A default pretty printing method for general objects that are
[295] Fix | Delete
# detected as part of a cycle.
[296] Fix | Delete
def pretty_print_cycle(q)
[297] Fix | Delete
q.object_address_group(self) {
[298] Fix | Delete
q.breakable
[299] Fix | Delete
q.text '...'
[300] Fix | Delete
}
[301] Fix | Delete
end
[302] Fix | Delete
[303] Fix | Delete
# Returns a sorted array of instance variable names.
[304] Fix | Delete
#
[305] Fix | Delete
# This method should return an array of names of instance variables as symbols or strings as:
[306] Fix | Delete
# +[:@a, :@b]+.
[307] Fix | Delete
def pretty_print_instance_variables
[308] Fix | Delete
instance_variables.sort
[309] Fix | Delete
end
[310] Fix | Delete
[311] Fix | Delete
# Is #inspect implementation using #pretty_print.
[312] Fix | Delete
# If you implement #pretty_print, it can be used as follows.
[313] Fix | Delete
#
[314] Fix | Delete
# alias inspect pretty_print_inspect
[315] Fix | Delete
#
[316] Fix | Delete
# However, doing this requires that every class that #inspect is called on
[317] Fix | Delete
# implement #pretty_print, or a RuntimeError will be raised.
[318] Fix | Delete
def pretty_print_inspect
[319] Fix | Delete
if Object.instance_method(:method).bind(self).call(:pretty_print).owner == PP::ObjectMixin
[320] Fix | Delete
raise "pretty_print is not overridden for #{self.class}"
[321] Fix | Delete
end
[322] Fix | Delete
PP.singleline_pp(self, ''.dup)
[323] Fix | Delete
end
[324] Fix | Delete
end
[325] Fix | Delete
end
[326] Fix | Delete
[327] Fix | Delete
class Array # :nodoc:
[328] Fix | Delete
def pretty_print(q) # :nodoc:
[329] Fix | Delete
q.group(1, '[', ']') {
[330] Fix | Delete
q.seplist(self) {|v|
[331] Fix | Delete
q.pp v
[332] Fix | Delete
}
[333] Fix | Delete
}
[334] Fix | Delete
end
[335] Fix | Delete
[336] Fix | Delete
def pretty_print_cycle(q) # :nodoc:
[337] Fix | Delete
q.text(empty? ? '[]' : '[...]')
[338] Fix | Delete
end
[339] Fix | Delete
end
[340] Fix | Delete
[341] Fix | Delete
class Hash # :nodoc:
[342] Fix | Delete
def pretty_print(q) # :nodoc:
[343] Fix | Delete
q.pp_hash self
[344] Fix | Delete
end
[345] Fix | Delete
[346] Fix | Delete
def pretty_print_cycle(q) # :nodoc:
[347] Fix | Delete
q.text(empty? ? '{}' : '{...}')
[348] Fix | Delete
end
[349] Fix | Delete
end
[350] Fix | Delete
[351] Fix | Delete
class << ENV # :nodoc:
[352] Fix | Delete
def pretty_print(q) # :nodoc:
[353] Fix | Delete
h = {}
[354] Fix | Delete
ENV.keys.sort.each {|k|
[355] Fix | Delete
h[k] = ENV[k]
[356] Fix | Delete
}
[357] Fix | Delete
q.pp_hash h
[358] Fix | Delete
end
[359] Fix | Delete
end
[360] Fix | Delete
[361] Fix | Delete
class Struct # :nodoc:
[362] Fix | Delete
def pretty_print(q) # :nodoc:
[363] Fix | Delete
q.group(1, sprintf("#<struct %s", PP.mcall(self, Kernel, :class).name), '>') {
[364] Fix | Delete
q.seplist(PP.mcall(self, Struct, :members), lambda { q.text "," }) {|member|
[365] Fix | Delete
q.breakable
[366] Fix | Delete
q.text member.to_s
[367] Fix | Delete
q.text '='
[368] Fix | Delete
q.group(1) {
[369] Fix | Delete
q.breakable ''
[370] Fix | Delete
q.pp self[member]
[371] Fix | Delete
}
[372] Fix | Delete
}
[373] Fix | Delete
}
[374] Fix | Delete
end
[375] Fix | Delete
[376] Fix | Delete
def pretty_print_cycle(q) # :nodoc:
[377] Fix | Delete
q.text sprintf("#<struct %s:...>", PP.mcall(self, Kernel, :class).name)
[378] Fix | Delete
end
[379] Fix | Delete
end
[380] Fix | Delete
[381] Fix | Delete
class Range # :nodoc:
[382] Fix | Delete
def pretty_print(q) # :nodoc:
[383] Fix | Delete
q.pp self.begin
[384] Fix | Delete
q.breakable ''
[385] Fix | Delete
q.text(self.exclude_end? ? '...' : '..')
[386] Fix | Delete
q.breakable ''
[387] Fix | Delete
q.pp self.end
[388] Fix | Delete
end
[389] Fix | Delete
end
[390] Fix | Delete
[391] Fix | Delete
class String # :nodoc:
[392] Fix | Delete
def pretty_print(q) # :nodoc:
[393] Fix | Delete
lines = self.lines
[394] Fix | Delete
if lines.size > 1
[395] Fix | Delete
q.group(0, '', '') do
[396] Fix | Delete
q.seplist(lines, lambda { q.text ' +'; q.breakable }) do |v|
[397] Fix | Delete
q.pp v
[398] Fix | Delete
end
[399] Fix | Delete
end
[400] Fix | Delete
else
[401] Fix | Delete
q.text inspect
[402] Fix | Delete
end
[403] Fix | Delete
end
[404] Fix | Delete
end
[405] Fix | Delete
[406] Fix | Delete
class File < IO # :nodoc:
[407] Fix | Delete
class Stat # :nodoc:
[408] Fix | Delete
def pretty_print(q) # :nodoc:
[409] Fix | Delete
require 'etc.so'
[410] Fix | Delete
q.object_group(self) {
[411] Fix | Delete
q.breakable
[412] Fix | Delete
q.text sprintf("dev=0x%x", self.dev); q.comma_breakable
[413] Fix | Delete
q.text "ino="; q.pp self.ino; q.comma_breakable
[414] Fix | Delete
q.group {
[415] Fix | Delete
m = self.mode
[416] Fix | Delete
q.text sprintf("mode=0%o", m)
[417] Fix | Delete
q.breakable
[418] Fix | Delete
q.text sprintf("(%s %c%c%c%c%c%c%c%c%c)",
[419] Fix | Delete
self.ftype,
[420] Fix | Delete
(m & 0400 == 0 ? ?- : ?r),
[421] Fix | Delete
(m & 0200 == 0 ? ?- : ?w),
[422] Fix | Delete
(m & 0100 == 0 ? (m & 04000 == 0 ? ?- : ?S) :
[423] Fix | Delete
(m & 04000 == 0 ? ?x : ?s)),
[424] Fix | Delete
(m & 0040 == 0 ? ?- : ?r),
[425] Fix | Delete
(m & 0020 == 0 ? ?- : ?w),
[426] Fix | Delete
(m & 0010 == 0 ? (m & 02000 == 0 ? ?- : ?S) :
[427] Fix | Delete
(m & 02000 == 0 ? ?x : ?s)),
[428] Fix | Delete
(m & 0004 == 0 ? ?- : ?r),
[429] Fix | Delete
(m & 0002 == 0 ? ?- : ?w),
[430] Fix | Delete
(m & 0001 == 0 ? (m & 01000 == 0 ? ?- : ?T) :
[431] Fix | Delete
(m & 01000 == 0 ? ?x : ?t)))
[432] Fix | Delete
}
[433] Fix | Delete
q.comma_breakable
[434] Fix | Delete
q.text "nlink="; q.pp self.nlink; q.comma_breakable
[435] Fix | Delete
q.group {
[436] Fix | Delete
q.text "uid="; q.pp self.uid
[437] Fix | Delete
begin
[438] Fix | Delete
pw = Etc.getpwuid(self.uid)
[439] Fix | Delete
rescue ArgumentError
[440] Fix | Delete
end
[441] Fix | Delete
if pw
[442] Fix | Delete
q.breakable; q.text "(#{pw.name})"
[443] Fix | Delete
end
[444] Fix | Delete
}
[445] Fix | Delete
q.comma_breakable
[446] Fix | Delete
q.group {
[447] Fix | Delete
q.text "gid="; q.pp self.gid
[448] Fix | Delete
begin
[449] Fix | Delete
gr = Etc.getgrgid(self.gid)
[450] Fix | Delete
rescue ArgumentError
[451] Fix | Delete
end
[452] Fix | Delete
if gr
[453] Fix | Delete
q.breakable; q.text "(#{gr.name})"
[454] Fix | Delete
end
[455] Fix | Delete
}
[456] Fix | Delete
q.comma_breakable
[457] Fix | Delete
q.group {
[458] Fix | Delete
q.text sprintf("rdev=0x%x", self.rdev)
[459] Fix | Delete
if self.rdev_major && self.rdev_minor
[460] Fix | Delete
q.breakable
[461] Fix | Delete
q.text sprintf('(%d, %d)', self.rdev_major, self.rdev_minor)
[462] Fix | Delete
end
[463] Fix | Delete
}
[464] Fix | Delete
q.comma_breakable
[465] Fix | Delete
q.text "size="; q.pp self.size; q.comma_breakable
[466] Fix | Delete
q.text "blksize="; q.pp self.blksize; q.comma_breakable
[467] Fix | Delete
q.text "blocks="; q.pp self.blocks; q.comma_breakable
[468] Fix | Delete
q.group {
[469] Fix | Delete
t = self.atime
[470] Fix | Delete
q.text "atime="; q.pp t
[471] Fix | Delete
q.breakable; q.text "(#{t.tv_sec})"
[472] Fix | Delete
}
[473] Fix | Delete
q.comma_breakable
[474] Fix | Delete
q.group {
[475] Fix | Delete
t = self.mtime
[476] Fix | Delete
q.text "mtime="; q.pp t
[477] Fix | Delete
q.breakable; q.text "(#{t.tv_sec})"
[478] Fix | Delete
}
[479] Fix | Delete
q.comma_breakable
[480] Fix | Delete
q.group {
[481] Fix | Delete
t = self.ctime
[482] Fix | Delete
q.text "ctime="; q.pp t
[483] Fix | Delete
q.breakable; q.text "(#{t.tv_sec})"
[484] Fix | Delete
}
[485] Fix | Delete
}
[486] Fix | Delete
end
[487] Fix | Delete
end
[488] Fix | Delete
end
[489] Fix | Delete
[490] Fix | Delete
class MatchData # :nodoc:
[491] Fix | Delete
def pretty_print(q) # :nodoc:
[492] Fix | Delete
nc = []
[493] Fix | Delete
self.regexp.named_captures.each {|name, indexes|
[494] Fix | Delete
indexes.each {|i| nc[i] = name }
[495] Fix | Delete
}
[496] Fix | Delete
q.object_group(self) {
[497] Fix | Delete
q.breakable
[498] Fix | Delete
q.seplist(0...self.size, lambda { q.breakable }) {|i|
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function