gzuncompress
|
Server IP : 172.19.0.3 / Your IP : 216.73.216.178 Web Server : Apache/2.4 System : Linux 880f91b28fd7 5.15.0-117-generic #127~20.04.1-Ubuntu SMP Thu Jul 11 15:36:12 UTC 2024 x86_64 User : tomlinde ( 155017) PHP Version : 5.6.40 Disable Function : dl, syslog, opcache_get_status MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/../../usr/lib/ruby/vendor_ruby/power_assert/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] | [ Lock Shell ] | [ Logout ] |
|---|
require 'power_assert/configuration'
module PowerAssert
class InspectedValue
def initialize(value)
@value = value
end
def inspect
@value
end
end
private_constant :InspectedValue
class SafeInspectable
def initialize(value)
@value = value
end
def inspect
inspected = @value.inspect
if Encoding.compatible?(Encoding.default_external, inspected)
inspected
else
begin
"#{inspected.encode(Encoding.default_external)}(#{inspected.encoding})"
rescue Encoding::UndefinedConversionError, Encoding::InvalidByteSequenceError
inspected.force_encoding(Encoding.default_external)
end
end
rescue => e
"InspectionFailure: #{e.class}: #{e.message.each_line.first}"
end
end
private_constant :SafeInspectable
class Formatter
def initialize(value, indent)
@value = value
@indent = indent
end
def inspect
if PowerAssert.configuration._colorize_message
if PowerAssert.configuration._use_pp
width = [(defined?(Pry::Terminal) ? Pry::Terminal.width! : Pry.new(output: StringIO.new).output.width) - 1 - @indent, 10].max
Pry::ColorPrinter.pp(@value, '', width)
else
Pry::Code.new(@value.inspect).highlighted
end
else
if PowerAssert.configuration._use_pp
PP.pp(@value, '')
else
@value.inspect
end
end
end
end
private_constant :Formatter
end