Sha256: 8b1c12c54940d1cd2c3f6b290673d1a46caff028c9911fa9da532d2fec7827dc

Contents?: true

Size: 601 Bytes

Versions: 7

Compression:

Stored size: 601 Bytes

Contents

module Kernel
  def pretty_inspect
    inspect
  end

  def pp(*objs)
    objs.each do |obj|
      PP.pp(obj)
    end
    objs.size <= 1 ? objs.first : objs
  end
  module_function :pp
end

class PP
  class << self
    if `(typeof(console) === "undefined" || typeof(console.log) === "undefined")`
      def pp(obj, out = $stdout, width = 79)
        p(*args)
      end
    else
      def pp(obj, out = $stdout, width = 79)
        if String === out
          out + obj.inspect + "\n"
        else
          out << obj.inspect + "\n"
        end
      end
    end

    alias singleline_pp pp
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
opal-1.0.5 stdlib/pp.rb
opal-1.0.4 stdlib/pp.rb
opal-1.0.3 stdlib/pp.rb
opal-1.0.2 stdlib/pp.rb
opal-1.0.1 stdlib/pp.rb
opal-1.0.0 stdlib/pp.rb
opal-1.0.0.beta1 stdlib/pp.rb