configurator2 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/configurator/configuration.rb +2 -1
- data/spec/lib/configurator_spec.rb +12 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
@@ -34,7 +34,8 @@ module Configurator
|
|
34
34
|
def set(name, value, &block)
|
35
35
|
name = name.to_sym
|
36
36
|
if block_given?
|
37
|
-
self[name]
|
37
|
+
self[name] ||= defaults[name] || self.class.new
|
38
|
+
self[name].instance_eval(&block)
|
38
39
|
elsif value.is_a?(Hash)
|
39
40
|
self[name] = defaults[name] || self.class.new
|
40
41
|
value.each do |key, value_two|
|
@@ -78,12 +78,12 @@ describe Configurator do
|
|
78
78
|
it "returns nil when a value is explicitly nil" do
|
79
79
|
TestClass.send(:option, :current_user_method, :current_user)
|
80
80
|
TestClass.config.current_user_method.should == :current_user
|
81
|
-
#TestClass.config.current_user_method = nil
|
82
81
|
TestClass.config do
|
83
82
|
current_user_method nil
|
84
83
|
end
|
85
84
|
TestClass.config.current_user_method.should be_nil
|
86
85
|
end
|
86
|
+
|
87
87
|
it "accepts a setter format" do
|
88
88
|
TestClass.send(:option, :do_something, "now!")
|
89
89
|
TestClass.config.do_something = "later..."
|
@@ -130,6 +130,17 @@ describe Configurator do
|
|
130
130
|
TestClass.config.sub.name.should == :face
|
131
131
|
TestClass.config.sub.sub.name.should == :fiz
|
132
132
|
end
|
133
|
+
|
134
|
+
it "allows block format for writing options" do
|
135
|
+
TestClass.config do
|
136
|
+
advanced_options do
|
137
|
+
bitrate 2048
|
138
|
+
fps 60
|
139
|
+
end
|
140
|
+
end
|
141
|
+
TestClass.config.advanced_options.bitrate.should == 2048
|
142
|
+
TestClass.config.advanced_options.fps.should == 60
|
143
|
+
end
|
133
144
|
end
|
134
145
|
|
135
146
|
it "adds an `options` method that defines many options with default nil values" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configurator2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
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-
|
12
|
+
date: 2013-02-03 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ''
|
15
15
|
email: flip@getplinq.com
|