centroid 1.1.0.pre.alpha3 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32db5ae25caa826680c6150fc818113a935d5fde
4
- data.tar.gz: b64c473a5e2bf525a9d3c105bee06081467fc355
3
+ metadata.gz: 2b3f16a749848af2f78c074074d10450d30ae1a2
4
+ data.tar.gz: 4be849c2e61291bdd321ad33ea329d96fd2bd690
5
5
  SHA512:
6
- metadata.gz: 00a3f269031593a8f8d2a9808f8879677b07557dd70bf51f336ed41dd4569a4f308dc00ffc3271b7f58773340133d52e65b0e5b05e9e0afa1c662d78460f45ca
7
- data.tar.gz: 046077cad9cb0c0c2bae6fc23c1b156ceeb59e814bf6e2d95ec4674281140f9539c9d44b9bf0d2a040393f24e4b9c5acc49472b404802ec777b5a60fb30af439
6
+ metadata.gz: 8d67614bf0beedf2f43140521ae37ea201282c5608f7763bb909750bb8db1dd88b982aecd5b9668248bc6fc44ce41b852fe296e3ad15672071f229702aa67fe9
7
+ data.tar.gz: 5cbc45a4b9a2c138ad803e82c03932127d2f5e36750dbc3deebaa22dd68ac2228b5cce61a85e485e96da354670b462707fc2d91727693042946a8818915ccf80
data/centroid.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'centroid'
3
- s.version = '1.1.0-alpha3'
3
+ s.version = '1.1.0'
4
4
  s.summary = 'A centralizaed paradigm to configuration management.'
5
5
  s.description = 'Centroid is a tool for loading configuration values declared in JSON, and accessing those configuration values using object properties.'
6
6
  s.author = 'Resource Data, Inc'
data/lib/centroid.rb CHANGED
@@ -40,6 +40,8 @@ module Centroid
40
40
 
41
41
  if value.is_a?(Hash)
42
42
  Config.new(value)
43
+ elsif value.is_a?(Array)
44
+ value.map { |e| e.is_a?(Hash) ? Config.new(e) : e }
43
45
  else
44
46
  value
45
47
  end
@@ -7,6 +7,10 @@ class ConfigTests < Test::Unit::TestCase
7
7
  '{"theEnvironment":{"theKey":"TheValue"}}'
8
8
  end
9
9
 
10
+ def json_config_with_array
11
+ '{"theArray":[{"theKey": "Value1"},{"theKey": "Value2"}]}'
12
+ end
13
+
10
14
  def shared_file_path
11
15
  'config.json'
12
16
  end
@@ -120,6 +124,22 @@ class ConfigTests < Test::Unit::TestCase
120
124
  assert(!config.respond_to?(:does_not_exist))
121
125
  end
122
126
 
127
+ def test_indexing_json_array
128
+ config = Centroid::Config.new(json_config_with_array)
129
+ assert_equal(config.the_array[0].the_key, "Value1")
130
+ assert_equal(config.the_array[1].the_key, "Value2")
131
+ end
132
+
133
+ def test_enumerating_json_array
134
+ config = Centroid::Config.new(json_config_with_array)
135
+ itemCount = 0
136
+ config.the_array.each do |item|
137
+ assert_equal(item.the_key, config.the_array[itemCount].the_key)
138
+ itemCount += 1
139
+ end
140
+ assert_equal(itemCount, 2)
141
+ end
142
+
123
143
  def test_enumerating_json_object
124
144
  config = Centroid::Config.new(json_config)
125
145
  itemCount = 0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: centroid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.pre.alpha3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Resource Data, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-10 00:00:00.000000000 Z
11
+ date: 2014-08-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Centroid is a tool for loading configuration values declared in JSON,
14
14
  and accessing those configuration values using object properties.
@@ -36,12 +36,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
36
36
  version: '0'
37
37
  required_rubygems_version: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">"
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: 1.3.1
41
+ version: '0'
42
42
  requirements: []
43
43
  rubyforge_project:
44
- rubygems_version: 2.3.0
44
+ rubygems_version: 2.4.1
45
45
  signing_key:
46
46
  specification_version: 4
47
47
  summary: A centralizaed paradigm to configuration management.