in_array 0.1.7 → 1.0.3
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 +5 -5
- data/CODE_OF_CONDUCT.md +49 -0
- data/README.md +28 -17
- data/in_array.gemspec +6 -8
- data/lib/in_array/version.rb +1 -1
- data/rakefile.rb +2 -11
- data/reek.txt +1 -1
- data/tests/in_array_test.rb +0 -3
- metadata +18 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2ebb2b5091ee96fe078cc413e39fbac3c24b57180854cc73f26f4d46ca83287d
|
4
|
+
data.tar.gz: ec5d4a5e96fd619f8f14b0af415fe982d6df04be945406df38db552d7615df1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecc89c74bc9d1aa8604ec000eae48dda82f9f2d30f6f00937c9b79062f8d4289054c2f9fedee856aa1fe61858361af28127b95cf8b24c6f1bcdc4c926a904d06
|
7
|
+
data.tar.gz: 8f3732da33662f152cf914952b8882d663aa00873f20e817e381e316e7cbb3e571a135c4ba8563096ee7d6d36269f66f448ef4f162eb67befd6a1a1c0e0d4156
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at peter.c.camilleri@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/README.md
CHANGED
@@ -82,49 +82,50 @@ penalty. The benchmark tests that follow show that the in_array gem should be
|
|
82
82
|
expected to improve performance when compared with the simulated polymorphism
|
83
83
|
alternative.
|
84
84
|
|
85
|
+
All benchmarks were done with:
|
86
|
+
ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
|
87
|
+
|
85
88
|
The first test assumes a simple scenario with only the Array class. Polymorphism
|
86
89
|
is simulated using the is_a? method:
|
87
90
|
|
88
|
-
C:\Sites\in_array>ruby bench\simple_bench.rb
|
89
91
|
Warming up --------------------------------------
|
90
92
|
Process with in_array
|
91
|
-
5.
|
93
|
+
5.332k i/100ms
|
92
94
|
Process with is_a?
|
93
|
-
4.
|
95
|
+
4.084k i/100ms
|
94
96
|
Calculating -------------------------------------
|
95
97
|
Process with in_array
|
96
|
-
|
98
|
+
60.573k (± 0.2%) i/s - 303.924k in 5.017537s
|
97
99
|
Process with is_a?
|
98
|
-
|
100
|
+
45.736k (± 0.2%) i/s - 228.704k in 5.000545s
|
99
101
|
|
100
102
|
Comparison:
|
101
|
-
Process with in_array:
|
102
|
-
Process with is_a? :
|
103
|
+
Process with in_array: 60572.6 i/s
|
104
|
+
Process with is_a? : 45736.0 i/s - 1.32x slower
|
103
105
|
|
104
106
|
The second scenario adds a user defined array like class. In this case, two
|
105
107
|
methods of simulated polymorphism are tested, based on include? and a hash
|
106
108
|
of allowed array classes. Here are those results.
|
107
109
|
|
108
|
-
C:\Sites\in_array>ruby bench\complex_bench.rb
|
109
110
|
Warming up --------------------------------------
|
110
111
|
Process with in_array
|
111
|
-
5.
|
112
|
+
5.334k i/100ms
|
112
113
|
Process with hash[]
|
113
|
-
1.
|
114
|
+
1.565k i/100ms
|
114
115
|
Process with include?
|
115
|
-
|
116
|
+
2.656k i/100ms
|
116
117
|
Calculating -------------------------------------
|
117
118
|
Process with in_array
|
118
|
-
|
119
|
+
60.959k (± 0.3%) i/s - 309.372k in 5.075113s
|
119
120
|
Process with hash[]
|
120
|
-
|
121
|
+
16.323k (± 0.7%) i/s - 82.945k in 5.081691s
|
121
122
|
Process with include?
|
122
|
-
|
123
|
+
28.529k (± 0.2%) i/s - 143.424k in 5.027394s
|
123
124
|
|
124
125
|
Comparison:
|
125
|
-
Process with in_array:
|
126
|
-
Process with include?:
|
127
|
-
Process with hash[] :
|
126
|
+
Process with in_array: 60959.3 i/s
|
127
|
+
Process with include?: 28528.6 i/s - 2.14x slower
|
128
|
+
Process with hash[] : 16323.1 i/s - 3.73x slower
|
128
129
|
|
129
130
|
## Contributing
|
130
131
|
|
@@ -141,3 +142,13 @@ of allowed array classes. Here are those results.
|
|
141
142
|
Go to the GitHub repository and raise an issue calling attention to some
|
142
143
|
aspect that could use some TLC or a suggestion or an idea.
|
143
144
|
|
145
|
+
## License
|
146
|
+
|
147
|
+
The gem is available as open source under the terms of the
|
148
|
+
[MIT License](./LICENSE.txt).
|
149
|
+
|
150
|
+
## Code of Conduct
|
151
|
+
|
152
|
+
Everyone interacting in the fully_freeze project’s codebases, issue trackers,
|
153
|
+
chat rooms and mailing lists is expected to follow the
|
154
|
+
[code of conduct](./CODE_OF_CONDUCT.md).
|
data/in_array.gemspec
CHANGED
@@ -13,23 +13,21 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.version = InArray::VERSION
|
14
14
|
s.author = ["Peter Camilleri"]
|
15
15
|
s.email = "peter.c.camilleri@gmail.com"
|
16
|
-
s.homepage = "
|
16
|
+
s.homepage = "https://github.com/PeterCamilleri/in_array"
|
17
17
|
s.platform = Gem::Platform::RUBY
|
18
18
|
s.required_ruby_version = '>=1.9.3'
|
19
19
|
|
20
|
-
s.add_development_dependency
|
21
|
-
s.add_development_dependency "
|
22
|
-
s.add_development_dependency '
|
23
|
-
s.add_development_dependency 'reek', "~>
|
24
|
-
s.add_development_dependency '
|
25
|
-
s.add_development_dependency 'rdoc', "~> 4.0.1"
|
20
|
+
s.add_development_dependency "bundler", ">= 2.1.0"
|
21
|
+
s.add_development_dependency "rake", ">= 12.3.3"
|
22
|
+
s.add_development_dependency 'minitest', "~> 5.7"
|
23
|
+
s.add_development_dependency 'reek', "~> 5.0.2"
|
24
|
+
s.add_development_dependency 'rdoc', "~> 5.0"
|
26
25
|
|
27
26
|
s.files = `git ls-files`.split($/)
|
28
27
|
s.extra_rdoc_files = ['license.txt']
|
29
28
|
s.test_files = ['tests/in_array_test.rb']
|
30
29
|
|
31
30
|
s.license = 'MIT'
|
32
|
-
s.has_rdoc = true
|
33
31
|
s.require_path = 'lib'
|
34
32
|
end
|
35
33
|
|
data/lib/in_array/version.rb
CHANGED
data/rakefile.rb
CHANGED
@@ -2,26 +2,17 @@
|
|
2
2
|
# coding: utf-8
|
3
3
|
|
4
4
|
require 'rake/testtask'
|
5
|
-
require 'rdoc/task'
|
6
5
|
require "bundler/gem_tasks"
|
7
6
|
|
8
|
-
RDoc::Task.new do |rdoc|
|
9
|
-
rdoc.rdoc_dir = "rdoc"
|
10
|
-
|
11
|
-
#List out all the files to be documented.
|
12
|
-
rdoc.rdoc_files.include("lib/**/*.rb", "license.txt", "readme.md")
|
13
|
-
|
14
|
-
rdoc.options << '--visibility' << 'private'
|
15
|
-
end
|
16
|
-
|
17
7
|
Rake::TestTask.new do |t|
|
18
8
|
t.test_files = ['tests/in_array_test.rb']
|
19
9
|
t.verbose = false
|
10
|
+
t.warning = true
|
20
11
|
end
|
21
12
|
|
22
13
|
desc "Run a scan for smelly code!"
|
23
14
|
task :reek do |t|
|
24
|
-
`reek lib
|
15
|
+
`reek --no-color lib > reek.txt`
|
25
16
|
end
|
26
17
|
|
27
18
|
desc "Fire up an IRB session with in_array preloaded."
|
data/reek.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
0 total warnings
|
data/tests/in_array_test.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require_relative '../lib/in_array'
|
2
2
|
gem 'minitest'
|
3
3
|
require 'minitest/autorun'
|
4
|
-
require 'minitest_visible'
|
5
4
|
|
6
5
|
class MyArray
|
7
6
|
include InArrayAlready
|
@@ -13,8 +12,6 @@ class NotAnArray
|
|
13
12
|
end
|
14
13
|
|
15
14
|
class InArrayTester < Minitest::Test
|
16
|
-
#Track mini-test progress.
|
17
|
-
include MinitestVisible
|
18
15
|
|
19
16
|
def test_the_basics
|
20
17
|
assert(InArray, "The module InArray should exist.")
|
metadata
CHANGED
@@ -1,99 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: in_array
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Camilleri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.1.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.3'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.3'
|
26
|
+
version: 2.1.0
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: rake
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
31
|
- - ">="
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
33
|
+
version: 12.3.3
|
48
34
|
type: :development
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
38
|
- - ">="
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
40
|
+
version: 12.3.3
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
42
|
+
name: minitest
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
45
|
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
47
|
+
version: '5.7'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
54
|
+
version: '5.7'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
56
|
+
name: reek
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
59
|
- - "~>"
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
61
|
+
version: 5.0.2
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
66
|
- - "~>"
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
68
|
+
version: 5.0.2
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: rdoc
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
73
|
- - "~>"
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
75
|
+
version: '5.0'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
82
|
+
version: '5.0'
|
97
83
|
description: 'Encapsulate data in an array unless it''s already in one. '
|
98
84
|
email: peter.c.camilleri@gmail.com
|
99
85
|
executables: []
|
@@ -102,6 +88,7 @@ extra_rdoc_files:
|
|
102
88
|
- license.txt
|
103
89
|
files:
|
104
90
|
- ".gitignore"
|
91
|
+
- CODE_OF_CONDUCT.md
|
105
92
|
- Gemfile
|
106
93
|
- README.md
|
107
94
|
- bench/complex_bench.rb
|
@@ -114,7 +101,7 @@ files:
|
|
114
101
|
- rakefile.rb
|
115
102
|
- reek.txt
|
116
103
|
- tests/in_array_test.rb
|
117
|
-
homepage:
|
104
|
+
homepage: https://github.com/PeterCamilleri/in_array
|
118
105
|
licenses:
|
119
106
|
- MIT
|
120
107
|
metadata: {}
|
@@ -133,11 +120,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
120
|
- !ruby/object:Gem::Version
|
134
121
|
version: '0'
|
135
122
|
requirements: []
|
136
|
-
|
137
|
-
rubygems_version: 2.2.2
|
123
|
+
rubygems_version: 3.2.17
|
138
124
|
signing_key:
|
139
125
|
specification_version: 4
|
140
126
|
summary: Encapsulate data in an array.
|
141
127
|
test_files:
|
142
128
|
- tests/in_array_test.rb
|
143
|
-
has_rdoc: true
|