uber 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/README.md +2 -1
- data/lib/uber/builder.rb +7 -6
- data/lib/uber/uber_version.rb +1 -1
- data/test/builder_test.rb +3 -3
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c817ac8bf31287641d793288fd317cb89818c834
|
4
|
+
data.tar.gz: 79d88494f259334a88606b95bd4f1e3315d9248f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ef9075f772764e736bfee3213d525be71d65ef1b23b23fa787bc0886f748d8a59049c567648c20e6aacd06b8f5c7ecfea10f17d775b14ea401e8eeaf7b15d65
|
7
|
+
data.tar.gz: e9441a4deb06ba1630bb7e06bebebbb7f679b5448a6013a878caa9f108f64a8d1817ab5e0ce11445dbffa3957929156b20c6771fe8fce836a55f9a1703a2e763
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -229,8 +229,9 @@ Listener.build({}) #=> Listener
|
|
229
229
|
Listener.build({current_user: @current_user}) #=> SignedIn
|
230
230
|
```
|
231
231
|
|
232
|
-
|
232
|
+
Note that builders are _not_ inherited to subclasses. This allows instantiating subclasses directly without running builders.
|
233
233
|
|
234
|
+
This pattern is used in [Cells](https://github.com/apotonick/cells), [Trailblazer](https://github.com/apotonick/trailblazer) and soon Reform and Representable/Roar, too.
|
234
235
|
|
235
236
|
# Version
|
236
237
|
|
data/lib/uber/builder.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'uber/inheritable_attr'
|
2
|
-
|
3
1
|
module Uber
|
4
2
|
# When included, allows to add builder on the class level.
|
5
3
|
#
|
@@ -21,10 +19,13 @@ module Uber
|
|
21
19
|
# end
|
22
20
|
module Builder
|
23
21
|
def self.included(base)
|
24
|
-
base.
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
base.class_eval do
|
23
|
+
def self.builders
|
24
|
+
@builders ||= []
|
25
|
+
end
|
26
|
+
|
27
|
+
extend ClassMethods
|
28
|
+
end
|
28
29
|
end
|
29
30
|
|
30
31
|
class Constant
|
data/lib/uber/uber_version.rb
CHANGED
data/test/builder_test.rb
CHANGED
@@ -49,11 +49,11 @@ class BuilderTest < MiniTest::Spec
|
|
49
49
|
it { Track.build({hit: true}).must_be_instance_of Hit }
|
50
50
|
|
51
51
|
|
52
|
-
# test inheritance.
|
52
|
+
# test inheritance. builder do not inherit.
|
53
53
|
class Play < Song
|
54
54
|
end
|
55
55
|
|
56
56
|
it { Play.build({}).must_be_instance_of Play }
|
57
|
-
it { Play.build({evergreen: true}).must_be_instance_of
|
58
|
-
it { Play.build({hit: true}).must_be_instance_of
|
57
|
+
it { Play.build({evergreen: true}).must_be_instance_of Play }
|
58
|
+
it { Play.build({hit: true}).must_be_instance_of Play }
|
59
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
90
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.2.
|
91
|
+
rubygems_version: 2.2.2
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: Gem-authoring tools like class method inheritance in modules, dynamic options
|
@@ -102,4 +102,3 @@ test_files:
|
|
102
102
|
- test/test_helper.rb
|
103
103
|
- test/version_test.rb
|
104
104
|
- test/zeugs.rb
|
105
|
-
has_rdoc:
|