human_hash 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/human_hash.rb +3 -2
- data/test/human_hash_test.rb +8 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/human_hash.rb
CHANGED
@@ -31,10 +31,11 @@ class Hash
|
|
31
31
|
if hh.is_a?(Hash)
|
32
32
|
count, padd = 0, ' ' * @@human_count
|
33
33
|
hh.each_key do |key|
|
34
|
+
kitem = symbols && key.is_a?(String) ? ":#{key}" : key.inspect
|
34
35
|
if hh[key].is_a?(Hash)
|
35
|
-
hs << "#{padd}#{
|
36
|
+
hs << "#{padd}#{kitem} => {\n#{display_values_for_human(hh[key], symbols)}#{padd}}"
|
36
37
|
else
|
37
|
-
hs << "#{padd}#{
|
38
|
+
hs << "#{padd}#{kitem} => #{hh[key].inspect}"
|
38
39
|
end
|
39
40
|
hs << ',' if (count += 1) < hh.size
|
40
41
|
hs << "\n"
|
data/test/human_hash_test.rb
CHANGED
@@ -18,7 +18,14 @@ require 'test/helper'
|
|
18
18
|
|
19
19
|
class LoggerTest < Test::Unit::TestCase
|
20
20
|
should "set the api key" do
|
21
|
-
hh = {
|
21
|
+
hh = {
|
22
|
+
"whatever" => {
|
23
|
+
"whatever" => {
|
24
|
+
"one" => "one", "two" => "two", "array" => [0,1,2], "bool" => true, "another" => { "more" => "more", "and" => "and" } }
|
25
|
+
},
|
26
|
+
2 => "two",
|
27
|
+
4 => "four"
|
28
|
+
}
|
22
29
|
hs = hh.human_inspect
|
23
30
|
hm = hh.human_inspect(false)
|
24
31
|
puts hs
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: human_hash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Eric Woodward
|