Sha256: 82edec517265eecf21db27ae9a869b9f6e85bfa99ed8ac6963d7055c714a6a35

Contents?: true

Size: 390 Bytes

Versions: 7

Compression:

Stored size: 390 Bytes

Contents

module Kernel

  # Alternate to standard #p method that outputs
  # Kernel#inspect to stdout, but also passes through
  # the orginal argument(s).
  #
  #   x = 1
  #   r = 4 + q(1)
  #   p r
  #
  # produces
  #
  #   1
  #   5
  #
  # DEPRECATE AS OF 1.9, _if_ #p will then do this too.

  def p(*x)
    x.each{ |e| puts e.inspect } #p(*x)
    x.size > 1 ? x : x.last #x.last
  end

end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
facets-2.4.0 lib/facets/kernel/p.rb
facets-2.4.1 lib/facets/kernel/p.rb
facets-2.4.3 lib/core/facets/kernel/p.rb
facets-2.4.2 lib/core/facets/kernel/p.rb
facets-2.4.4 lib/core/facets/kernel/p.rb
facets-2.4.5 lib/core/facets/kernel/p.rb
mack-facets-0.8.2 lib/gems/facets-2.4.5/lib/core/facets/kernel/p.rb