configuration 1.1.0 → 1.2.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/LICENSE ADDED
@@ -0,0 +1 @@
1
+ same as ruby's
@@ -3,11 +3,11 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "configuration"
6
- spec.version = "1.1.0"
6
+ spec.version = "1.2.0"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "configuration"
9
9
 
10
- spec.files = ["config", "config/a.rb", "config/b.rb", "config/c.rb", "config/d.rb", "config/e.rb", "configuration.gemspec", "lib", "lib/configuration.rb", "Rakefile", "README", "README.erb", "samples", "samples/a.rb", "samples/b.rb", "samples/c.rb", "samples/d.rb", "samples/e.rb"]
10
+ spec.files = ["config", "config/a.rb", "config/b.rb", "config/c.rb", "config/d.rb", "config/e.rb", "configuration.gemspec", "lib", "lib/configuration.rb", "LICENSE", "Rakefile", "README", "README.erb", "samples", "samples/a.rb", "samples/b.rb", "samples/c.rb", "samples/d.rb", "samples/e.rb"]
11
11
  spec.executables = []
12
12
 
13
13
 
@@ -1,5 +1,5 @@
1
1
  class Configuration
2
- Configuration::Version = '1.1.0'
2
+ Configuration::Version = '1.2.0'
3
3
  def Configuration.version() Configuration::Version end
4
4
 
5
5
  Path = [
@@ -12,7 +12,6 @@ class Configuration
12
12
 
13
13
  Table = Hash.new
14
14
  Error = Class.new StandardError
15
- Import = Class.new Error
16
15
 
17
16
  module ClassMethods
18
17
  def for name, options = nil, &block
@@ -72,6 +71,38 @@ class Configuration
72
71
  return(Pure[@__parent].send m, *a, &b) rescue super if @__parent
73
72
  super
74
73
  end
74
+
75
+ include Enumerable
76
+
77
+ def each
78
+ methods(false).each{|v| yield v }
79
+ end
80
+
81
+ def to_hash
82
+ inject({}){ |h,name|
83
+ val = __send__(name.to_sym)
84
+ h.update name.to_sym => Configuration === val ? val.to_hash : val
85
+ }
86
+ end
87
+
88
+ def update options = {}, &block
89
+ DSL.evaluate(self, options, &block)
90
+ end
91
+
92
+ def dup
93
+ ret = self.class.new @name
94
+ each do |name|
95
+ val = __send__ name.to_sym
96
+ if Configuration === val
97
+ val = val.dup
98
+ val.instance_variable_set('@__parent', ret)
99
+ DSL.evaluate(ret, name.to_sym => val)
100
+ else
101
+ DSL.evaluate(ret, name.to_sym => (val.dup rescue val))
102
+ end
103
+ end
104
+ ret
105
+ end
75
106
  end
76
107
  send :include, InstanceMethods
77
108
 
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configuration
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ hash: 31
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 2
9
+ - 0
10
+ version: 1.2.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - Ara T. Howard
@@ -9,7 +15,7 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2009-09-23 00:00:00 -06:00
18
+ date: 2010-11-18 00:00:00 -07:00
13
19
  default_executable:
14
20
  dependencies: []
15
21
 
@@ -22,19 +28,17 @@ extensions: []
22
28
  extra_rdoc_files: []
23
29
 
24
30
  files:
25
- - config
26
31
  - config/a.rb
27
32
  - config/b.rb
28
33
  - config/c.rb
29
34
  - config/d.rb
30
35
  - config/e.rb
31
36
  - configuration.gemspec
32
- - lib
33
37
  - lib/configuration.rb
38
+ - LICENSE
34
39
  - Rakefile
35
40
  - README
36
41
  - README.erb
37
- - samples
38
42
  - samples/a.rb
39
43
  - samples/b.rb
40
44
  - samples/c.rb
@@ -42,29 +46,37 @@ files:
42
46
  - samples/e.rb
43
47
  has_rdoc: true
44
48
  homepage: http://github.com/ahoward/configuration/tree/master
49
+ licenses: []
50
+
45
51
  post_install_message:
46
52
  rdoc_options: []
47
53
 
48
54
  require_paths:
49
55
  - lib
50
56
  required_ruby_version: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ">="
53
60
  - !ruby/object:Gem::Version
61
+ hash: 3
62
+ segments:
63
+ - 0
54
64
  version: "0"
55
- version:
56
65
  required_rubygems_version: !ruby/object:Gem::Requirement
66
+ none: false
57
67
  requirements:
58
68
  - - ">="
59
69
  - !ruby/object:Gem::Version
70
+ hash: 3
71
+ segments:
72
+ - 0
60
73
  version: "0"
61
- version:
62
74
  requirements: []
63
75
 
64
76
  rubyforge_project: codeforpeople
65
- rubygems_version: 1.3.1
77
+ rubygems_version: 1.3.7
66
78
  signing_key:
67
- specification_version: 2
79
+ specification_version: 3
68
80
  summary: configuration
69
81
  test_files: []
70
82