much-mixin 0.2.3 → 0.2.4

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: 622a26403cc037812349be1ac6393a9b267edabab50137fb0fa22822a22bbd74
4
- data.tar.gz: e4f1741bf4d76cbf19801e28c444b13d1d105c1904f6ceb25521f9661e9551bd
3
+ metadata.gz: 4cd3b3ff89ffb2a612c02541f09f18c025a0ef46fc7271bc44061b7b2ac3e326
4
+ data.tar.gz: eed7d18665c5168db9c3fdeaaaea17e16ec99b617f9ff6acba9a6961fe17ab7a
5
5
  SHA512:
6
- metadata.gz: f60941f782d2429172804bbbbd019f4e5861826c1e35f98fc57891b00c692fc6fa2253d6770c271fd96797f69d7b0515a1c5f20e9471ee0bb7cdaf583ee9850b
7
- data.tar.gz: 9d28a55999e7bff176243d45cbd5a087864d82449841793a152df65d17ac9b02deee595549575c565afab36fcd19d668d3c4c6e408241a2d9a504d973cceb5ba
6
+ metadata.gz: 9570aaebd82ebc4cc3790f62a37ff80d82f282af41b3b1d920956cfd49d2e67eda2a1f24f069e0b6da94f28bd5f4787b464cc24b9f5c3e68fb7aca57ec534f7b
7
+ data.tar.gz: 4cec9e801f5aa719f577f7078bba22125973f8aab20103dbc969f47bb69ad8859a4ac19d504e2fb185814622c0dad45645f44ec6cdecf2896176240b0c547047
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "much-mixin"
2
4
  require "benchmark"
3
5
 
@@ -12,24 +12,24 @@ module MuchMixin
12
12
  # included. If it has not been, include the receiver mixin and run all of
13
13
  # the `mixin_included` blocks.
14
14
  def included(mixin_receiver)
15
- return if mixin_receiver.include?(self.much_mixin_included_detector)
16
- mixin_receiver.send(:include, self.much_mixin_included_detector)
15
+ return if mixin_receiver.include?(much_mixin_included_detector)
16
+ mixin_receiver.send(:include, much_mixin_included_detector)
17
17
 
18
- self.much_mixin_included_blocks.each do |block|
18
+ much_mixin_included_blocks.each do |block|
19
19
  mixin_receiver.class_eval(&block)
20
20
  end
21
21
 
22
- self.much_mixin_class_method_blocks.each do |block|
23
- self.much_mixin_class_methods_module.class_eval(&block)
22
+ much_mixin_class_method_blocks.each do |block|
23
+ much_mixin_class_methods_module.class_eval(&block)
24
24
  end
25
- mixin_receiver.send(:extend, self.much_mixin_class_methods_module)
25
+ mixin_receiver.send(:extend, much_mixin_class_methods_module)
26
26
 
27
- self.much_mixin_instance_method_blocks.each do |block|
28
- self.much_mixin_instance_methods_module.class_eval(&block)
27
+ much_mixin_instance_method_blocks.each do |block|
28
+ much_mixin_instance_methods_module.class_eval(&block)
29
29
  end
30
- mixin_receiver.send(:include, self.much_mixin_instance_methods_module)
30
+ mixin_receiver.send(:include, much_mixin_instance_methods_module)
31
31
 
32
- self.much_mixin_after_included_blocks.each do |block|
32
+ much_mixin_after_included_blocks.each do |block|
33
33
  mixin_receiver.class_eval(&block)
34
34
  end
35
35
  end
@@ -41,19 +41,19 @@ module MuchMixin
41
41
  # be tracked back to much-mixin.
42
42
  def much_mixin_included_detector
43
43
  @much_mixin_included_detector ||= Module.new.tap do |m|
44
- self.const_set("MuchMixinIncludedDetector", m)
44
+ const_set("MuchMixinIncludedDetector", m)
45
45
  end
46
46
  end
47
47
 
48
48
  def much_mixin_class_methods_module
49
49
  @much_mixin_class_methods_module ||= Module.new.tap do |m|
50
- self.const_set("MuchMixinClassMethods", m)
50
+ const_set("MuchMixinClassMethods", m)
51
51
  end
52
52
  end
53
53
 
54
54
  def much_mixin_instance_methods_module
55
55
  @much_mixin_instance_methods_module ||= Module.new.tap do |m|
56
- self.const_set("MuchMixinInstanceMethods", m)
56
+ const_set("MuchMixinInstanceMethods", m)
57
57
  end
58
58
  end
59
59
 
@@ -74,19 +74,19 @@ module MuchMixin
74
74
  end
75
75
 
76
76
  def mixin_included(&block)
77
- self.much_mixin_included_blocks << block
77
+ much_mixin_included_blocks << block
78
78
  end
79
79
 
80
80
  def after_mixin_included(&block)
81
- self.much_mixin_after_included_blocks << block
81
+ much_mixin_after_included_blocks << block
82
82
  end
83
83
 
84
84
  def mixin_class_methods(&block)
85
- self.much_mixin_class_method_blocks << block
85
+ much_mixin_class_method_blocks << block
86
86
  end
87
87
 
88
88
  def mixin_instance_methods(&block)
89
- self.much_mixin_instance_method_blocks << block
89
+ much_mixin_instance_method_blocks << block
90
90
  end
91
91
  end
92
92
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MuchMixin
4
- VERSION = "0.2.3"
4
+ VERSION = "0.2.4"
5
5
  end
@@ -1,3 +1,4 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  # frozen_string_literal: true
2
3
 
3
4
  lib = File.expand_path("../lib", __FILE__)
@@ -9,17 +10,19 @@ Gem::Specification.new do |gem|
9
10
  gem.version = MuchMixin::VERSION
10
11
  gem.authors = ["Kelly Redding", "Collin Redding"]
11
12
  gem.email = ["kelly@kellyredding.com", "collin.redding@me.com"]
12
- gem.summary = %q{Enhanced mix-in API.}
13
- gem.description = %q{Enhanced mix-in API.}
13
+ gem.summary = "Enhanced mix-in API."
14
+ gem.description = "Enhanced mix-in API."
14
15
  gem.homepage = "http://github.com/redding/much-mixin"
15
16
  gem.license = "MIT"
16
17
 
17
- gem.files = `git ls-files`.split($/)
18
+ gem.files = `git ls-files | grep "^[^.]"`.split($INPUT_RECORD_SEPARATOR)
19
+
18
20
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
19
21
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
20
22
  gem.require_paths = ["lib"]
21
23
 
22
24
  gem.required_ruby_version = "~> 2.5"
23
25
 
24
- gem.add_development_dependency("assert", ["~> 2.19.2"])
26
+ gem.add_development_dependency("much-style-guide", ["~> 0.6.0"])
27
+ gem.add_development_dependency("assert", ["~> 2.19.2"])
25
28
  end
@@ -14,7 +14,8 @@ module MuchMixin
14
14
  end
15
15
  subject{ @muchmixin }
16
16
 
17
- should have_imeths :much_mixin_included_detector, :much_mixin_included_blocks
17
+ should have_imeths :much_mixin_included_detector
18
+ should have_imeths :much_mixin_included_blocks
18
19
  should have_imeths :mixin_included, :after_mixin_included
19
20
 
20
21
  should "know its included detector" do
@@ -43,12 +44,27 @@ module MuchMixin
43
44
  desc "when mixed in"
44
45
  setup do
45
46
  @receiver = Class.new do
46
- def self.inc_block1; @block1_count ||= 0; @block1_count += 1; end
47
- def self.block1_count; @block1_count ||= 0; end
48
- def self.inc_block2; @block2_count ||= 0; @block2_count += 1; end
49
- def self.block2_count; @block2_count ||= 0; end
47
+ def self.inc_block1
48
+ @block1_count ||= 0
49
+ @block1_count += 1
50
+ 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
50
60
 
51
- def self.do_something_count; @do_something_count ||= 0; end
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
52
68
  end
53
69
  end
54
70
 
@@ -109,10 +125,10 @@ module MuchMixin
109
125
  include MuchMixin
110
126
 
111
127
  mixin_included{ inc_block1 }
112
- after_mixin_included{
128
+ after_mixin_included do
113
129
  inc_block2
114
130
  do_something
115
- }
131
+ end
116
132
 
117
133
  mixin_class_methods do
118
134
  def do_something
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: much-mixin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Redding
@@ -9,8 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-01-07 00:00:00.000000000 Z
12
+ date: 2021-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: much-style-guide
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 0.6.0
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 0.6.0
14
28
  - !ruby/object:Gem::Dependency
15
29
  name: assert
16
30
  requirement: !ruby/object:Gem::Requirement
@@ -33,7 +47,6 @@ executables: []
33
47
  extensions: []
34
48
  extra_rdoc_files: []
35
49
  files:
36
- - ".gitignore"
37
50
  - Gemfile
38
51
  - LICENSE
39
52
  - README.md
@@ -66,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
79
  - !ruby/object:Gem::Version
67
80
  version: '0'
68
81
  requirements: []
69
- rubygems_version: 3.1.2
82
+ rubygems_version: 3.2.4
70
83
  signing_key:
71
84
  specification_version: 4
72
85
  summary: Enhanced mix-in API.
data/.gitignore DELETED
@@ -1,19 +0,0 @@
1
- *.gem
2
- *.log
3
- *.rbc
4
- .rbx/
5
- .bundle
6
- .config
7
- .yardoc
8
- Gemfile.lock
9
- InstalledFiles
10
- _yardoc
11
- coverage
12
- doc/
13
- lib/bundler/man
14
- pkg
15
- rdoc
16
- spec/reports
17
- test/tmp
18
- test/version_tmp
19
- tmp