In Files

  • power_assert-1.1.7/lib/power_assert/inspector.rb

Parent

Methods

PowerAssert::Formatter

Public Class Methods

new(value, indent) click to toggle source
 
               # File power_assert-1.1.7/lib/power_assert/inspector.rb, line 38
def initialize(value, indent)
  @value = value
  @indent = indent
end
            

Public Instance Methods

inspect() click to toggle source
 
               # File power_assert-1.1.7/lib/power_assert/inspector.rb, line 43
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