blank_slate 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/blank_slate/version.rb +1 -1
- data/lib/blank_slate.rb +2 -2
- data/test/blank_slate_test.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b19c0d346d419abd6b9e1237277ed2d81d0e2485e2dee7d0e370b87a204f244
|
4
|
+
data.tar.gz: 24db981812537197620fb585ba9e747a6b9d26c0c8df5c66c3634945f6c5b284
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e60ba1c59e65c5ef8929fd7cbd990b95909abb019071dd8bedc5d41739085ec1e580176899fee19eeded66a3b71df3e4cf51284cb2f35693c6821666ce779c1b
|
7
|
+
data.tar.gz: 5ba74f1d5122d6f7dd12a95b18c09332397dd3d5592c8013f2ae92cc030abc5e39561fb9359ab9164be3d3d29b6f0c8c145267ca80c437773f8c90add804e93b
|
data/CHANGELOG.md
CHANGED
data/lib/blank_slate/version.rb
CHANGED
data/lib/blank_slate.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module BlankSlate
|
2
|
-
def BlankSlate(klass, &block)
|
2
|
+
def BlankSlate(klass, default_value: nil, &block)
|
3
3
|
blank_slate = Class.new(klass, &block)
|
4
4
|
blank_slate.class_eval do
|
5
5
|
(klass.instance_methods(false) - instance_methods(false)).each do |meth|
|
6
|
-
define_method(meth){
|
6
|
+
define_method(meth){ default_value }
|
7
7
|
end
|
8
8
|
end
|
9
9
|
blank_slate
|
data/test/blank_slate_test.rb
CHANGED
@@ -61,4 +61,9 @@ describe "BlankSlate" do
|
|
61
61
|
null_object = blank_slate.new
|
62
62
|
assert_equal null_object.inherited, 'this should be inherited'
|
63
63
|
end
|
64
|
+
|
65
|
+
it "uses the specified default_value for the return" do
|
66
|
+
null_object = BlankSlate(BlankSlate::TesterClass, default_value: "blank").new
|
67
|
+
assert_equal "blank", null_object.one
|
68
|
+
end
|
64
69
|
end
|