Sha256: 8a53bdc5e9a2bb1f132471158e57d141ab8d98d31a9cf70b78b18cec1b7c39bf

Contents?: true

Size: 657 Bytes

Versions: 7

Compression:

Stored size: 657 Bytes

Contents

module Kernel
  def pretty_inspect
    inspect
  end

  def pp(*objs)
    objs.each {|obj|
      PP.pp(obj)
    }
    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=`console`, width=79)
        if `#{out} === console`
          `console.log(obj)`
        elsif 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 & 2 rubygems

Version Path
opal-0.8.1 stdlib/pp.rb
opal-0.8.1.rc1 stdlib/pp.rb
opal-wedge-0.9.0.dev stdlib/pp.rb
opal-0.8.0 stdlib/pp.rb
opal-0.8.0.rc3 stdlib/pp.rb
opal-0.8.0.rc2 stdlib/pp.rb
opal-0.8.0.rc1 stdlib/pp.rb