Sha256: f8586fb50fb87eb15b3ce0a2cdc28100608746ba1b28de875b9d34eff7d8ef58

Contents?: true

Size: 394 Bytes

Versions: 10

Compression:

Stored size: 394 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 + p(1)
  #   p r
  #
  # produces ...
  #
  #   1
  #   5
  #
  # TODO: DEPRECATE as of 1.9, _if_ it will do this.

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

end

Version data entries

10 entries across 9 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 lib/core/facets/kernel/p.rb
facets-3.1.0 lib/core/facets/kernel/p.rb
facets-3.0.0 lib/core/facets/kernel/p.rb
facets-2.9.3 lib/core/facets/kernel/p.rb
facets-2.9.2 lib/core/facets/kernel/p.rb
facets-2.9.2 src/core/facets/kernel/p.rb
facets-2.9.1 lib/core/facets/kernel/p.rb
facets-2.9.0 lib/core/facets/kernel/p.rb
facets-2.9.0.pre.2 lib/core/facets/kernel/p.rb
facets-2.9.0.pre.1 lib/core/facets/kernel/p.rb