diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-03-07 02:05:08 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-03-07 02:05:08 +0000 |
commit | 6645b928266cf7f8139f58b6b260e82f291d8446 (patch) | |
tree | 79b669fd89b447f950a4faced7ceebcba65b8f8e /lib | |
parent | 57b3ed4cda8882429590f761f9d545eee88823a3 (diff) | |
download | ruby-6645b928266cf7f8139f58b6b260e82f291d8446.tar.gz |
* object.c (inspect_obj): unintended space removal.
[ruby-dev:25810]
* eval.c (rb_exec_recursive): should not use NODE in disclosed
context. [ruby-dev:25812]
* io.c (rb_f_open): need not to check if to_open value is a
T_FILE. [ruby-dev:25812]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cgi/session.rb | 4 | ||||
-rw-r--r-- | lib/pp.rb | 24 |
2 files changed, 19 insertions, 9 deletions
diff --git a/lib/cgi/session.rb b/lib/cgi/session.rb index 8741799390..2bb6571bf6 100644 --- a/lib/cgi/session.rb +++ b/lib/cgi/session.rb @@ -155,8 +155,8 @@ class CGI # class Session - #:nodoc: - class NoSession < RuntimeError; end + class NoSession < RuntimeError #:nodoc: + end # The id of this session. attr_reader :session_id, :new_session @@ -95,19 +95,29 @@ class PP < PrettyPrint def guard_inspect_key if Thread.current[InspectKey] == nil - Thread.current[InspectKey] = [] + Thread.current[InspectKey] = {inspect: []} end - save = Thread.current[InspectKey] + save = Thread.current[InspectKey][:inspect] begin - Thread.current[InspectKey] = [] + Thread.current[InspectKey][:inspect] = [] yield ensure - Thread.current[InspectKey] = save + Thread.current[InspectKey][:inspect] = save end end + def check_inspect_key(id) + Thread.current[InspectKey][:inspect].include?(id) + end + def push_inspect_key(id) + Thread.current[InspectKey][:inspect] << id + end + def pop_inspect_key + Thread.current[InspectKey][:inspect].pop + end + # Adds +obj+ to the pretty printing buffer # using Object#pretty_print or Object#pretty_print_cycle. # @@ -116,16 +126,16 @@ class PP < PrettyPrint def pp(obj) id = obj.__id__ - if Thread.current[InspectKey].include? id + if check_inspect_key(id) group {obj.pretty_print_cycle self} return end begin - Thread.current[InspectKey] << id + push_inspect_key(id) group {obj.pretty_print self} ensure - Thread.current[InspectKey].pop unless PP.sharing_detection + pop_inspect_key unless PP.sharing_detection end end |