human_hash 0.0.1 → 0.1.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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
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}#{symbols ? ':' + key.to_s : key.inspect} => {\n#{display_values_for_human(hh[key], symbols)}#{padd}}"
36
+ hs << "#{padd}#{kitem} => {\n#{display_values_for_human(hh[key], symbols)}#{padd}}"
36
37
  else
37
- hs << "#{padd}#{symbols ? ':' + key.to_s : key.inspect} => #{hh[key].inspect}"
38
+ hs << "#{padd}#{kitem} => #{hh[key].inspect}"
38
39
  end
39
40
  hs << ',' if (count += 1) < hh.size
40
41
  hs << "\n"
@@ -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 = { "whatever" => { "whatever" => { "one" => "one", "two" => "two", "array" => [0,1,2], "bool" => true, "another" => { "more" => "more", "and" => "and" } } } }
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: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 0
9
8
  - 1
10
- version: 0.0.1
9
+ - 0
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Eric Woodward