much-mixin 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +8 -2
- data/lib/much-mixin/version.rb +1 -1
- data/lib/much-mixin.rb +12 -9
- data/much-mixin.gemspec +1 -1
- data/test/unit/much-mixin_tests.rb +28 -26
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e88e83b0e621e6b15d53b0c87d75bb9c7e53bf05e96d4bbefca045be6c7b7a8c
|
4
|
+
data.tar.gz: e2a41ae1d6f632fa50a8205350088b809f7f94702f9ebdc10484c599bb76a200
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2106be7106e9c9b5175fa5e494d132d8317215e543878ada39f5922dafb4f5dbe343ca008506dbda27e3365778a3a46149ffe7f3657836e1c749c9f66288fe8f
|
7
|
+
data.tar.gz: 694312535ce959a673bfff368674c0f280fa9c95f7a36810e0dbb960c01f134b035cdb4ccb38466d428212454fcc45b5d403d7315db99d86a3918c9e7f0e0db0
|
data/Gemfile
CHANGED
@@ -2,11 +2,17 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
ruby "
|
5
|
+
ruby ">= 2.5"
|
6
6
|
|
7
7
|
gemspec
|
8
8
|
|
9
9
|
gem "pry"
|
10
10
|
|
11
11
|
# to release, uncomment this and run `bundle exec ggem r -f`
|
12
|
-
|
12
|
+
gem "ggem"
|
13
|
+
|
14
|
+
gem "assert", path: "/Users/kellyredding/projects/tmp/assert"
|
15
|
+
gem "much-style-guide", path: "/Users/kellyredding/projects/tmp/much-style-guide"
|
16
|
+
gem "much-factory", path: "/Users/kellyredding/projects/tmp/much-factory"
|
17
|
+
gem "much-not-given", path: "/Users/kellyredding/projects/tmp/much-not-given"
|
18
|
+
gem "much-stub", path: "/Users/kellyredding/projects/tmp/much-stub"
|
data/lib/much-mixin/version.rb
CHANGED
data/lib/much-mixin.rb
CHANGED
@@ -40,21 +40,24 @@ module MuchMixin
|
|
40
40
|
# seen in the ancestors it doesn't look like some random module and it can
|
41
41
|
# be tracked back to much-mixin.
|
42
42
|
def much_mixin_included_detector
|
43
|
-
@much_mixin_included_detector ||=
|
44
|
-
|
45
|
-
|
43
|
+
@much_mixin_included_detector ||=
|
44
|
+
Module.new.tap do |m|
|
45
|
+
const_set("MuchMixinIncludedDetector", m)
|
46
|
+
end
|
46
47
|
end
|
47
48
|
|
48
49
|
def much_mixin_class_methods_module
|
49
|
-
@much_mixin_class_methods_module ||=
|
50
|
-
|
51
|
-
|
50
|
+
@much_mixin_class_methods_module ||=
|
51
|
+
Module.new.tap do |m|
|
52
|
+
const_set("MuchMixinClassMethods", m)
|
53
|
+
end
|
52
54
|
end
|
53
55
|
|
54
56
|
def much_mixin_instance_methods_module
|
55
|
-
@much_mixin_instance_methods_module ||=
|
56
|
-
|
57
|
-
|
57
|
+
@much_mixin_instance_methods_module ||=
|
58
|
+
Module.new.tap do |m|
|
59
|
+
const_set("MuchMixinInstanceMethods", m)
|
60
|
+
end
|
58
61
|
end
|
59
62
|
|
60
63
|
def much_mixin_included_blocks
|
data/much-mixin.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
22
22
|
gem.require_paths = ["lib"]
|
23
23
|
|
24
|
-
gem.required_ruby_version = "
|
24
|
+
gem.required_ruby_version = ">= 2.5"
|
25
25
|
|
26
26
|
gem.add_development_dependency("much-style-guide", ["~> 0.6.0"])
|
27
27
|
gem.add_development_dependency("assert", ["~> 2.19.2"])
|
@@ -43,29 +43,30 @@ module MuchMixin
|
|
43
43
|
class MixedInTests < UnitTests
|
44
44
|
desc "when mixed in"
|
45
45
|
setup do
|
46
|
-
@receiver =
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
@receiver =
|
47
|
+
Class.new do
|
48
|
+
def self.inc_block1
|
49
|
+
@block1_count ||= 0
|
50
|
+
@block1_count += 1
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.block1_count
|
54
|
+
@block1_count ||= 0
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.inc_block2
|
58
|
+
@block2_count ||= 0
|
59
|
+
@block2_count += 1
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.block2_count
|
63
|
+
@block2_count ||= 0
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.do_something_count
|
67
|
+
@do_something_count ||= 0
|
68
|
+
end
|
50
69
|
end
|
51
|
-
|
52
|
-
def self.block1_count
|
53
|
-
@block1_count ||= 0
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.inc_block2
|
57
|
-
@block2_count ||= 0
|
58
|
-
@block2_count += 1
|
59
|
-
end
|
60
|
-
|
61
|
-
def self.block2_count
|
62
|
-
@block2_count ||= 0
|
63
|
-
end
|
64
|
-
|
65
|
-
def self.do_something_count
|
66
|
-
@do_something_count ||= 0
|
67
|
-
end
|
68
|
-
end
|
69
70
|
end
|
70
71
|
|
71
72
|
should "call the mix-in included blocks" do
|
@@ -95,11 +96,12 @@ module MuchMixin
|
|
95
96
|
end
|
96
97
|
|
97
98
|
should "call blocks only once even if mixed in by a 3rd party" do
|
98
|
-
third_party =
|
99
|
-
|
100
|
-
|
99
|
+
third_party =
|
100
|
+
Module.new do
|
101
|
+
def self.included(receiver)
|
102
|
+
receiver.send(:include, TestMuchMixin)
|
103
|
+
end
|
101
104
|
end
|
102
|
-
end
|
103
105
|
@receiver.send(:include, third_party)
|
104
106
|
|
105
107
|
assert_equal 1, @receiver.block1_count
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: much-mixin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Redding
|
8
8
|
- Collin Redding
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-10-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: much-style-guide
|
@@ -64,13 +64,13 @@ homepage: http://github.com/redding/much-mixin
|
|
64
64
|
licenses:
|
65
65
|
- MIT
|
66
66
|
metadata: {}
|
67
|
-
post_install_message:
|
67
|
+
post_install_message:
|
68
68
|
rdoc_options: []
|
69
69
|
require_paths:
|
70
70
|
- lib
|
71
71
|
required_ruby_version: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '2.5'
|
76
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -79,8 +79,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
|
-
rubygems_version: 3.2.
|
83
|
-
signing_key:
|
82
|
+
rubygems_version: 3.2.29
|
83
|
+
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: Enhanced mix-in API.
|
86
86
|
test_files:
|