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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72b84dd5ad01afcfdb026bf9a830120e95a90c095fd362adcbeea433307bedec
4
- data.tar.gz: a76f1f4e546a0c20a1f91f72b58e4d0b39880bf79ab0a0ac468b4d72513abdf2
3
+ metadata.gz: 3b19c0d346d419abd6b9e1237277ed2d81d0e2485e2dee7d0e370b87a204f244
4
+ data.tar.gz: 24db981812537197620fb585ba9e747a6b9d26c0c8df5c66c3634945f6c5b284
5
5
  SHA512:
6
- metadata.gz: 8da83799e3f060a9f225a4c162c16fd60947cae61e99468e23dfe3fcdfa0d99fb88679776d904b02dae61a254115b10df2c646b532821d18f0539c3cfe946780
7
- data.tar.gz: 4f4ab28aa58ebd5bb13084111fe4b4f60ddd901f85ac5ac8d9159ea7a9fc706031a20ed2a031eedfe58fb21c3dde462972470081e1c1685fd333494e6600832e
6
+ metadata.gz: e60ba1c59e65c5ef8929fd7cbd990b95909abb019071dd8bedc5d41739085ec1e580176899fee19eeded66a3b71df3e4cf51284cb2f35693c6821666ce779c1b
7
+ data.tar.gz: 5ba74f1d5122d6f7dd12a95b18c09332397dd3d5592c8013f2ae92cc030abc5e39561fb9359ab9164be3d3d29b6f0c8c145267ca80c437773f8c90add804e93b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.1.3
2
+
3
+ Add the ability to specify the return value on BlankSlate methods
4
+
1
5
  # 1.1.2
2
6
 
3
7
  Minor change to simplify the methods that are iterated when creating the BlankSlate class.
@@ -1,3 +1,3 @@
1
1
  module BlankSlate
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
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){ nil }
6
+ define_method(meth){ default_value }
7
7
  end
8
8
  end
9
9
  blank_slate
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blank_slate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Gay