print_r 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/print_r/generator.rb +6 -3
- data/lib/print_r/recursion.rb +3 -4
- data/lib/print_r/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0620653988d560c5fdee527986e7f4087a810a0a
|
4
|
+
data.tar.gz: 66de0b3b8e60e98ddc0290e5513a13a899f8d33a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4138c046f1eb09815f49ac9d50c40bc312ab7626cb1a97350a30989389aa4c79db5bf0f492cb7aa40373763e8a931bf5e28ca6027de8f608c9bf48981e59b32d
|
7
|
+
data.tar.gz: 02991d3312cac082f5cf1073de59a063bd891f7fb14d4eeb09ff73ea4017a0fde23a70091a17eec1284e34d30518cdadcb31bc744b635a1c9507940ce4d468d5
|
data/lib/print_r/generator.rb
CHANGED
@@ -24,9 +24,7 @@ module PrintR
|
|
24
24
|
tab2 = " " * (indent+1)
|
25
25
|
str = nil
|
26
26
|
object_type = obj.class.name
|
27
|
-
|
28
|
-
is_recursive = 1<@recursive_objects[obj.object_id]
|
29
|
-
@recursive_objects[obj.object_id] += 1
|
27
|
+
obj_id = obj.respond_to?(:object_id) ? obj.object_id : obj.__id__
|
30
28
|
|
31
29
|
case obj
|
32
30
|
when Array
|
@@ -75,6 +73,9 @@ module PrintR
|
|
75
73
|
when Hash
|
76
74
|
str = "#{object_type} Object\n"
|
77
75
|
|
76
|
+
is_recursive = 1<@recursive_objects[obj_id]
|
77
|
+
@recursive_objects[obj_id] += 1
|
78
|
+
|
78
79
|
if is_recursive
|
79
80
|
str += " *RECURSION*"
|
80
81
|
else
|
@@ -84,6 +85,8 @@ module PrintR
|
|
84
85
|
end
|
85
86
|
str += tab1 + ")\n"
|
86
87
|
end
|
88
|
+
|
89
|
+
@recursive_objects[obj_id] -= 1
|
87
90
|
else
|
88
91
|
str = "#{obj}"
|
89
92
|
end
|
data/lib/print_r/recursion.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
module PrintR
|
2
|
-
class Recursion
|
2
|
+
class Recursion
|
3
3
|
attr_reader :object_type
|
4
4
|
|
5
|
-
def initialize(
|
6
|
-
@object_type =
|
7
|
-
super(error_message)
|
5
|
+
def initialize(object_type)
|
6
|
+
@object_type = object_type
|
8
7
|
end
|
9
8
|
|
10
9
|
def to_s
|
data/lib/print_r/version.rb
CHANGED