ruby-conf 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/ruby-conf.rb +7 -2
- data/ruby-conf.gemspec +2 -2
- data/spec/lib/ruby-conf_spec.rb +11 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.1
|
data/lib/ruby-conf.rb
CHANGED
@@ -28,9 +28,14 @@ class RubyConf < BasicObject
|
|
28
28
|
self
|
29
29
|
end
|
30
30
|
|
31
|
-
def [](name, args =
|
31
|
+
def [](name, args = [])
|
32
32
|
value = @__rc_attributes[name.to_sym]
|
33
|
-
value.is_a?(Proc)
|
33
|
+
if value.is_a?(Proc)
|
34
|
+
args += [nil] * (value.arity.abs - args.size) if value.arity.abs > args.size
|
35
|
+
__rc_root.instance_exec(*args, &value)
|
36
|
+
else
|
37
|
+
value
|
38
|
+
end
|
34
39
|
end
|
35
40
|
|
36
41
|
def __rc_copy(o)
|
data/ruby-conf.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "ruby-conf"
|
8
|
-
s.version = "2.2.
|
8
|
+
s.version = "2.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Curtis Schofield & Hollin Wilkins & Mason"]
|
12
|
-
s.date = "2012-12-
|
12
|
+
s.date = "2012-12-24"
|
13
13
|
s.description = "rubyconf is a ruby configuration dsl that aims to make it simple to write and read configurations for ruby apps without a yaml or xml file"
|
14
14
|
s.email = "blazingpair@blazingcloud.net"
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/lib/ruby-conf_spec.rb
CHANGED
@@ -21,6 +21,17 @@ describe RubyConf do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
Argue.you_are_a('My Love?').should == "Why are you such a jerk, My Love?"
|
24
|
+
|
25
|
+
RubyConf.define(:LambdaToString) do
|
26
|
+
no_args -> { "none" }
|
27
|
+
one_arg ->(arg) { "one|#{arg.inspect}" }
|
28
|
+
var_args ->(*args) { "var|#{args.inspect}" }
|
29
|
+
multi_args ->(one,two) { "multi|#{one.inspect}|#{two.inspect}" }
|
30
|
+
multi_var_args ->(one,*two,three) { "multivar|#{one.inspect}|#{two.inspect}|#{three.inspect}" }
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
LambdaToString.to_s.should == "[LambdaToString]\n\nmulti_args: multi|nil|nil\n\nmulti_var_args: multivar|nil|[nil]|nil\n\nno_args: none\n\none_arg: one|nil\n\nvar_args: var|[nil]\n\n"
|
24
35
|
end
|
25
36
|
end
|
26
37
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-conf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
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: 2012-12-
|
12
|
+
date: 2012-12-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -112,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
112
|
version: '0'
|
113
113
|
segments:
|
114
114
|
- 0
|
115
|
-
hash:
|
115
|
+
hash: 2499393105730204536
|
116
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
117
|
none: false
|
118
118
|
requirements:
|