mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/pp.rb: Revert part of r40834 and nodoc PP::ObjectMixin
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
596cecb057
commit
a3672d4bf4
2 changed files with 6 additions and 29 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Mon May 20 11:50:12 2013 Zachary Scott <zachary@zacharyscott.net>
|
||||||
|
|
||||||
|
* lib/pp.rb: Revert part of r40834 and nodoc PP::ObjectMixin
|
||||||
|
[ruby-core:55068]
|
||||||
|
|
||||||
Mon May 20 10:40:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Mon May 20 10:40:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* lib/webrick/htmlutils.rb (WEBrick::HTMLUtils#escape): replace HTML
|
* lib/webrick/htmlutils.rb (WEBrick::HTMLUtils#escape): replace HTML
|
||||||
|
|
30
lib/pp.rb
30
lib/pp.rb
|
@ -300,35 +300,7 @@ class PP < PrettyPrint
|
||||||
include PPMethods
|
include PPMethods
|
||||||
end
|
end
|
||||||
|
|
||||||
# Allows you to implement pretty print in your own class, for example:
|
module ObjectMixin # :nodoc:
|
||||||
# require 'pp'
|
|
||||||
#
|
|
||||||
# class Cat
|
|
||||||
# include PP::ObjectMixin
|
|
||||||
#
|
|
||||||
# attr_accessor :name, :age, :color
|
|
||||||
#
|
|
||||||
# def initialize name
|
|
||||||
# @name = name
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# def pretty_print q
|
|
||||||
# q.pp_object self
|
|
||||||
# end
|
|
||||||
# alias inspect pretty_print_inspect
|
|
||||||
#
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# In order to use this class, try the following:
|
|
||||||
#
|
|
||||||
# ginger = Cat.new("ginger")
|
|
||||||
# p ginger
|
|
||||||
# #=> #<Cat:0x007f8dfb994900 @name="ginger">
|
|
||||||
# ginger.age = 2
|
|
||||||
# ginger.color = "red"
|
|
||||||
# p ginger
|
|
||||||
# #=> #<Cat:0x007f8dfb994900 @age=2, @color="red", @name="ginger">
|
|
||||||
module ObjectMixin
|
|
||||||
# 1. specific pretty_print
|
# 1. specific pretty_print
|
||||||
# 2. specific inspect
|
# 2. specific inspect
|
||||||
# 3. generic pretty_print
|
# 3. generic pretty_print
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue