Class: PowerAssert::Formatter (Ruby 2.7.5)
Description: Class : PowerAssert::Formatter - Ruby 2.7.5

### Home Classes Methods

### In Files

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

### Parent

Object

### Methods

- ::new
- #inspect

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- PowerAssert
- PowerAssert::BlockContext
- PowerAssert::Configuration
- PowerAssert::Context
- PowerAssert::Empty
- PowerAssert::Formatter
- PowerAssert::InspectedValue
- PowerAssert::Parser
- PowerAssert::Parser::Branch
- PowerAssert::Parser::DummyParser
- PowerAssert::SafeInspectable
- PowerAssert::TraceContext

No matching classes.

# 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