module Kernel

Public Instance Methods

_betterp(raw, args, options = {}) click to toggle source
# File lib/kernel.rb, line 14
def _betterp(raw, args, options = {})
  source = Betterp::Source.new(raw, Dir.pwd)
  pretty = options.fetch(:pretty, false)

  Betterp::Output.new(raw, source, pretty: pretty).format(args).each do |str|
    STDOUT.write(str + "\n")
  end

  args.size > 1 ? args : args.first
end
p(*args) click to toggle source
# File lib/kernel.rb, line 4
def p(*args)
  raw = caller(1..1).first
  _betterp(raw, args)
end
pp(*args) click to toggle source
# File lib/kernel.rb, line 9
def pp(*args)
  raw = caller(1..1).first
  _betterp(raw, args, pretty: true)
end