simple-conf 0.2.1 → 0.3.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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzFkZGIwNzllOGQzOTBiMzI0MmY3NjNhNjkxNTU4MDQ3ODY2ZWYwOQ==
4
+ Y2Q5Yzc0ZTdhOTJlYzc1YzA0ZWU0ZTMzY2M1ZDliOWI0ZmE2MzJjYw==
5
5
  data.tar.gz: !binary |-
6
- OWU4NDlhMWU2ODM4YjU4NWE5MjZmMzc1YTIwNmQ0MGQ4MjliZjNhNg==
6
+ Zjc3YThiMzQ0MzU4MGZjYmQyYmFhMGY4YTY0ZmIyMWRmNTQ5MTc1Yg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDQ2ZGM5ODMwODk1NmRjZmYyOTAzYzVlZTYxMzU1MmY3YmUzMDQ3NGI2MTAx
10
- ZjI4ZDJlNWI2ZjBjNTI4MDhmYmMwNzQxNWU1NzgwOTYxODE0ZmVlMWQ2ZmZm
11
- OTlkMzcwY2I1ZmI0ZGRlZWI0ZTFjNzk1MWI1MzVhZmVhNDMzY2I=
9
+ YzAzOGJhZThlNGFlN2RjZTYzYzRlOGM0YjFiYzUxNDgzYjNiZWIyZTQ4YTg1
10
+ N2IzMzYxNzhiNDQ1NjRmZDVkZmZjNGIxZjJlZTAxYjcwN2ZlNzlhZTE5ZjE4
11
+ OTAwYzFhZDQxODQ1YWQwOTdhM2UwNDdmMGY3NjZmYWU5ZThiMTc=
12
12
  data.tar.gz: !binary |-
13
- NmZiNjA5OWFjMDNmMzk3Y2ZiNmNkYzliMzg4NjM4MWY0MjY4Mzc5YmExOTY0
14
- NTZjZjU0ZTc2MjVjYjIzOGUwMWNkYWE2ZmM5MzdmNTdhZjllZTBkODRlNjIy
15
- YWIyZWI0OWFlODRkNWVjNGFjNWJkOGNhMjc2NjIzYjk5ZWU2MmQ=
13
+ NTg1Njk0MThkMTUxZjQ2YzAwODE5ZDA3YzFkNjg0NTAxMWVkNTExYmJlNzhh
14
+ Y2VmZTc0YjRmMTQ4ZmZiZWViZWM3MTAxMGQ3MjczZjM5YjE4MDlmYTQzNmVk
15
+ ODVjMjM1NjE5YWE5MzA5NmQ0MGQyYTA4OGQ5Y2IwZmVkNGI0OTk=
@@ -4,6 +4,18 @@ require 'erb'
4
4
 
5
5
  module SimpleConf
6
6
  Loader = Struct.new(:klass) do
7
+ def initialize(klass)
8
+ super(klass)
9
+
10
+ klass.class_eval %Q{
11
+ class << self
12
+ attr_reader :keys
13
+ end
14
+
15
+ @keys = []
16
+ }
17
+ end
18
+
7
19
  def run
8
20
  paths.each do |path|
9
21
  load_file(path)
@@ -64,9 +76,15 @@ module SimpleConf
64
76
  class << self
65
77
  attr_reader :#{key}
66
78
  end
79
+
80
+ @keys.push(:#{key})
67
81
  }
68
82
  end
69
83
 
84
+ class << self
85
+ attr_reader :keys
86
+ end
87
+
70
88
  def set(key, value)
71
89
  define(key)
72
90
 
@@ -1,3 +1,3 @@
1
1
  module SimpleConf
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -125,6 +125,12 @@ describe SimpleConf do
125
125
  expect(Options2).to respond_to(:group1)
126
126
  expect(Options2).to respond_to(:group2)
127
127
  end
128
+
129
+ it 'should have .keys for iterating by root keys of the configuration file' do
130
+ expect(Options2.keys.size).to eq(2)
131
+ expect(Options2.keys).to include(:group1)
132
+ expect(Options2.keys).to include(:group2)
133
+ end
128
134
  end
129
135
 
130
136
  describe SimpleConf do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-conf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Korsak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-27 00:00:00.000000000 Z
11
+ date: 2015-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake