json-colorizer 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .idea/
3
3
  .DS_Store
4
4
  Gemfile.lock
5
+ json-colorizer-*.gem
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
11
11
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
12
12
  gem.require_paths = ['lib']
13
13
  gem.name = 'json-colorizer'
14
- gem.version = '0.0.1'
14
+ gem.version = '0.0.2'
15
15
 
16
16
  gem.add_dependency('colorize', '0.5.8')
17
17
  end
@@ -9,10 +9,9 @@ class JsonColorizer
9
9
 
10
10
  def format(data)
11
11
  parts = []
12
- @schema.each do |k, formatters|
13
- key = k.to_s
12
+ @schema.each do |key, formatters|
14
13
  formatters = [formatters] unless formatters.is_a?(Array)
15
- parts << apply_formatters(data[key], formatters)
14
+ parts << apply_formatters(data.fetch(key, data.fetch(key.to_s, nil)), formatters)
16
15
  end
17
16
 
18
17
  unless @other.nil?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json-colorizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-25 00:00:00.000000000 Z
12
+ date: 2013-03-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize