unnatural 0.1.0
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 +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +13 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +134 -0
- data/Rakefile +27 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ext/unnatural/extconf.rb +4 -0
- data/ext/unnatural/fast_compare.c +66 -0
- data/lib/unnatural.rb +36 -0
- data/lib/unnatural/fast.rb +13 -0
- data/lib/unnatural/scan.rb +48 -0
- data/lib/unnatural/split.rb +20 -0
- data/lib/unnatural/substitution.rb +20 -0
- data/lib/unnatural/version.rb +3 -0
- data/unnatural.gemspec +31 -0
- metadata +133 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ee0b35ed79162c58be6d1ed2af2022d18f19615d
|
4
|
+
data.tar.gz: 4be5c919b28dd739b6d1cc4f9c2d8d01d49b6411
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 41c9475d5c6f7fb41dd962ddb1a11a2d5ac212d3186028a0d4b0c248efa91c8489a37f8973f9acbb2324e4fac62b14cdaee08990bb16b5530cf7c6e8c521cff2
|
7
|
+
data.tar.gz: 5c19f5a7b5a05715d2967ea03104b3f3a7649d09bb7bac3476ea4d018707779f4f9ebd533ba8529fcb6e7ada69375a403aee9ec86017dbfdbc7c1d1eb719b1a9
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
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 bjmllr@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/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Ben Miller
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
# Unnatural
|
2
|
+
|
3
|
+
[](https://rubygems.org/gems/unnatural)
|
4
|
+
[](https://travis-ci.org/bjmllr/unnatural)
|
5
|
+
|
6
|
+
A natural sort for Ruby.
|
7
|
+
|
8
|
+
Unnatural defines a natural sort as one where:
|
9
|
+
|
10
|
+
1. comparison is case-insensitive
|
11
|
+
2. consecutive sequences of digits are compared according to their numeric value (not their ascii values)
|
12
|
+
|
13
|
+
Unnatural does not (currently) provide support for:
|
14
|
+
|
15
|
+
1. non-ASCII-compatible encoding
|
16
|
+
2. any number representation other than simple decimal integers
|
17
|
+
3. whitespace insensitivity (i.e., one space and two spaces can be considered as different)
|
18
|
+
|
19
|
+
Unnatural provides four algorithms, all of which use Ruby's built-in quicksort as the fundamental sort algorithm. All four modules provide module methods `.sort` for simply sorting an enumerable, and `.compare` for spaceship-operator-style comparison.
|
20
|
+
|
21
|
+
### Unnatural::Fast
|
22
|
+
|
23
|
+
Compares strings byte-by-byte. Comparison function implemented in C. Much faster than any of the pure Ruby options. The default, except on JRuby. Not available on JRuby.
|
24
|
+
|
25
|
+
### Unnatural::Scan
|
26
|
+
|
27
|
+
Compares strings using a `StringScanner`. Pure ruby. Tends to be outperformed by `Unnatural::Substitution` and `Unnatural::Split` when sorting short strings via the global sort function, but its comparison function is the fastest of the pure-ruby algorithms.
|
28
|
+
|
29
|
+
### Unnatural::Split
|
30
|
+
|
31
|
+
Compares strings by spliting them into arrays of alternating string and integer values. Pure Ruby. Tends to be outperformed by the others.
|
32
|
+
|
33
|
+
### Unnatural::Substitution
|
34
|
+
|
35
|
+
Compares strings by zero-padding integer sequences such that all are the same length. Pure Ruby. Tends to be outperformed by `Unnatural::Scan` on longer strings. The default on JRuby.
|
36
|
+
|
37
|
+
## Installation
|
38
|
+
|
39
|
+
Add this line to your application's Gemfile:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
gem 'unnatural'
|
43
|
+
```
|
44
|
+
|
45
|
+
And then execute:
|
46
|
+
|
47
|
+
$ bundle
|
48
|
+
|
49
|
+
Or install it yourself as:
|
50
|
+
|
51
|
+
$ gem install unnatural
|
52
|
+
|
53
|
+
## Usage
|
54
|
+
|
55
|
+
Sorting an enumerable of strings:
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
require 'unnatural'
|
59
|
+
sorted = Unnatural.sort(some_array_of_strings)
|
60
|
+
```
|
61
|
+
|
62
|
+
Defining the comparison method for a class explicitly:
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
require 'unnatural'
|
66
|
+
|
67
|
+
class User
|
68
|
+
def <=>(other)
|
69
|
+
Unnatural.compare(name, other.name)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
```
|
73
|
+
|
74
|
+
Or by defining `#to_str` and using Unnatural as a mix-in:
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
# this is equivalent to the last example
|
78
|
+
|
79
|
+
class User
|
80
|
+
include Unnatural
|
81
|
+
|
82
|
+
def to_str
|
83
|
+
name
|
84
|
+
end
|
85
|
+
end
|
86
|
+
```
|
87
|
+
|
88
|
+
The default can be changed throughout an application:
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
# use Scan instead of Fast
|
92
|
+
# (or, if on JRruby, use Scan instead of Substitution)
|
93
|
+
Unnatural.algorithm = Unnatural::Scan
|
94
|
+
```
|
95
|
+
|
96
|
+
Or you can use the `.compare` and `.sort` functions for an algorithm's module directly:
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
sorted_short_strings = Unnatural::Substitution.sort(some_short_strings)
|
100
|
+
sorted_long_strings = Unnatural::Scan.sort(some_long_strings)
|
101
|
+
|
102
|
+
class User
|
103
|
+
def <=>(other)
|
104
|
+
Unnatural::Scan.compare(name, other.name)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
```
|
108
|
+
|
109
|
+
## See Also
|
110
|
+
|
111
|
+
There are two other natural sort gems:
|
112
|
+
|
113
|
+
https://github.com/dogweather/naturally
|
114
|
+
|
115
|
+
https://github.com/johnnyshields/naturalsort
|
116
|
+
|
117
|
+
Unnatural took test cases from each one.
|
118
|
+
|
119
|
+
|
120
|
+
## Development
|
121
|
+
|
122
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
123
|
+
|
124
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
125
|
+
|
126
|
+
## Contributing
|
127
|
+
|
128
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/bjmllr/unnatural. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
129
|
+
|
130
|
+
|
131
|
+
## License
|
132
|
+
|
133
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
134
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/testtask'
|
3
|
+
|
4
|
+
Rake::TestTask.new(:test) do |t|
|
5
|
+
t.libs << 'test'
|
6
|
+
t.libs << 'lib'
|
7
|
+
t.test_files = FileList['test/**/*_test.rb']
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'rake/extensiontask'
|
11
|
+
spec = Gem::Specification.load('unnatural.gemspec')
|
12
|
+
Rake::ExtensionTask.new do |ext|
|
13
|
+
ext.name = 'fast_compare'
|
14
|
+
ext.ext_dir = 'ext/unnatural'
|
15
|
+
ext.lib_dir = 'lib/unnatural'
|
16
|
+
ext.gem_spec = spec
|
17
|
+
end
|
18
|
+
|
19
|
+
task :benchmark do
|
20
|
+
require './test/benchmark.rb'
|
21
|
+
end
|
22
|
+
|
23
|
+
if RUBY_ENGINE == 'jruby'
|
24
|
+
task default: :test
|
25
|
+
else
|
26
|
+
task default: [:compile, :test]
|
27
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'unnatural'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
|
3
|
+
static VALUE rb_mUnnatural;
|
4
|
+
static VALUE rb_mFast;
|
5
|
+
|
6
|
+
#define DIGIT_TO_I(C) (C - '0')
|
7
|
+
#define IS_DIGIT(C) ('0' <= C && C <= '9')
|
8
|
+
#define IS_LOWER(C) ('a' <= C && C <= 'z')
|
9
|
+
#define UPCASE(C) (IS_LOWER(C) ? C - ('a' - 'A') : C)
|
10
|
+
|
11
|
+
VALUE compare(VALUE self, VALUE a_value, VALUE b_value) {
|
12
|
+
int a_length = RSTRING_LEN(a_value);
|
13
|
+
int b_length = RSTRING_LEN(b_value);
|
14
|
+
char* a_str = RSTRING_PTR(a_value);
|
15
|
+
char* b_str = RSTRING_PTR(b_value);
|
16
|
+
int a_pos = 0;
|
17
|
+
int b_pos = 0;
|
18
|
+
int a_number = 0;
|
19
|
+
int b_number = 0;
|
20
|
+
char a, b;
|
21
|
+
int diff = 0;
|
22
|
+
|
23
|
+
for (a_pos = 0, b_pos = 0; a_pos < a_length && b_pos < b_length; a_pos++, b_pos++) {
|
24
|
+
a = a_str[a_pos];
|
25
|
+
b = b_str[b_pos];
|
26
|
+
|
27
|
+
if ( IS_DIGIT(a) && !IS_DIGIT(b)) return INT2FIX(-1);
|
28
|
+
if (!IS_DIGIT(a) && IS_DIGIT(b)) return INT2FIX(+1);
|
29
|
+
|
30
|
+
if (IS_DIGIT(a) && IS_DIGIT(b)) {
|
31
|
+
while (IS_DIGIT(a)) {
|
32
|
+
a_number = a_number * 10 + DIGIT_TO_I(a);
|
33
|
+
a_pos++;
|
34
|
+
a = a_str[a_pos];
|
35
|
+
}
|
36
|
+
|
37
|
+
while (IS_DIGIT(b)) {
|
38
|
+
b_number = b_number * 10 + DIGIT_TO_I(b);
|
39
|
+
b_pos++;
|
40
|
+
b = b_str[b_pos];
|
41
|
+
}
|
42
|
+
|
43
|
+
diff = a_number - b_number;
|
44
|
+
if (diff != 0) return INT2FIX(diff);
|
45
|
+
|
46
|
+
a_number = 0;
|
47
|
+
b_number = 0;
|
48
|
+
a_pos--;
|
49
|
+
b_pos--;
|
50
|
+
} else {
|
51
|
+
diff = UPCASE(a) - UPCASE(b);
|
52
|
+
if (diff != 0) return INT2FIX(diff);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
diff = a_length - b_length;
|
57
|
+
if (diff != 0) return INT2FIX(diff);
|
58
|
+
|
59
|
+
return INT2FIX(0);
|
60
|
+
}
|
61
|
+
|
62
|
+
void Init_fast_compare() {
|
63
|
+
rb_mUnnatural = rb_define_module("Unnatural");
|
64
|
+
rb_mFast = rb_define_module_under(rb_mUnnatural, "Fast");
|
65
|
+
rb_define_singleton_method(rb_mFast, "compare", compare, 2);
|
66
|
+
}
|
data/lib/unnatural.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'unnatural/version'
|
2
|
+
|
3
|
+
module Unnatural
|
4
|
+
def self.algorithms
|
5
|
+
[:Substitution, :Split, :Scan, :Fast]
|
6
|
+
.select { |name| const_defined?(name) }
|
7
|
+
.map { |name| const_get(name) }
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.algorithm
|
11
|
+
@algorithm
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.algorithm=(mod)
|
15
|
+
@algorithm = mod
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.sort(enumerable)
|
19
|
+
@algorithm.sort(enumerable)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.compare(a, b)
|
23
|
+
@algorithm.compare(a, b)
|
24
|
+
end
|
25
|
+
|
26
|
+
def <=>(other)
|
27
|
+
Unnatural.compare(to_str, other.to_str)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
require 'unnatural/fast'
|
32
|
+
|
33
|
+
Unnatural.algorithm ||= begin
|
34
|
+
require 'unnatural/substitution'
|
35
|
+
Unnatural::Substitution
|
36
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'strscan'
|
2
|
+
|
3
|
+
module Unnatural
|
4
|
+
module Scan
|
5
|
+
def self.sort(enumerable)
|
6
|
+
enumerable.sort { |a, b| compare(a, b) }
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.compare(a_string, b_string)
|
10
|
+
a = StringScanner.new(a_string)
|
11
|
+
b = StringScanner.new(b_string)
|
12
|
+
|
13
|
+
loop do
|
14
|
+
a_number = a.scan(/\d+/)
|
15
|
+
b_number = b.scan(/\d+/)
|
16
|
+
|
17
|
+
if a_number.nil? && b_number.nil?
|
18
|
+
# move on
|
19
|
+
elsif a_number.nil?
|
20
|
+
return +1
|
21
|
+
elsif b_number.nil?
|
22
|
+
return -1
|
23
|
+
else
|
24
|
+
compare = a_number.to_i <=> b_number.to_i
|
25
|
+
return compare unless compare == 0
|
26
|
+
end
|
27
|
+
|
28
|
+
a_segment = a.scan(/\D+/)
|
29
|
+
b_segment = b.scan(/\D+/)
|
30
|
+
|
31
|
+
if a_segment.nil? && b_segment.nil?
|
32
|
+
# move on
|
33
|
+
elsif a_segment.nil?
|
34
|
+
return -1
|
35
|
+
elsif b_segment.nil?
|
36
|
+
return +1
|
37
|
+
else
|
38
|
+
compare = a_segment.casecmp(b_segment)
|
39
|
+
return compare unless compare == 0
|
40
|
+
end
|
41
|
+
|
42
|
+
return 0 if a.eos? && b.eos?
|
43
|
+
return -1 if a.eos?
|
44
|
+
return +1 if b.eos?
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Unnatural
|
2
|
+
module Split
|
3
|
+
SPLITTER = /(?<=\d)(?=\D)|(?<=\D)(?=\d)/
|
4
|
+
PRED = ['0'.ord.pred.chr].freeze
|
5
|
+
|
6
|
+
def self.sort(enumerable)
|
7
|
+
enumerable.sort_by { |s| split(s) }
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.compare(a, b)
|
11
|
+
split(a) <=> split(b)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.split(string)
|
15
|
+
array = string.downcase.split(SPLITTER)
|
16
|
+
array = PRED + array if ('0'..'9').cover?(array[0])
|
17
|
+
array.map.with_index { |e, i| i.odd? ? e.to_i : e }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Unnatural
|
2
|
+
module Substitution
|
3
|
+
def self.sort(enumerable)
|
4
|
+
largest = enumerable.map(&:size).max
|
5
|
+
enumerable.sort_by { |s| substitute(s, largest) }
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.compare(a, b)
|
9
|
+
largest = a.size < b.size ? b.size : a.size
|
10
|
+
substitute(a, largest) <=> substitute(b, largest)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.substitute(string, size)
|
14
|
+
format_string = "%0#{size}d"
|
15
|
+
string.downcase.gsub(/\d+/) do |m|
|
16
|
+
format(format_string, m.gsub(/^0+(?=[1-9])/, ''))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/unnatural.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'unnatural/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'unnatural'
|
8
|
+
spec.version = Unnatural::VERSION
|
9
|
+
spec.authors = ['Ben Miller']
|
10
|
+
spec.email = ['bjmllr@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = 'A natural sort.'
|
13
|
+
spec.description = 'A natural sort implementation with an emphasis on speed.'
|
14
|
+
spec.homepage = 'https://github.com/bjmllr/unnatural'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
unless RUBY_ENGINE == 'jruby'
|
23
|
+
spec.extensions << 'ext/unnatural/extconf.rb'
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.add_development_dependency 'bundler'
|
27
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
28
|
+
spec.add_development_dependency 'rake-compiler', '~>0.9'
|
29
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
30
|
+
spec.add_development_dependency 'benchmark-ips'
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unnatural
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Miller
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake-compiler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.9'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.9'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '5.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: benchmark-ips
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: A natural sort implementation with an emphasis on speed.
|
84
|
+
email:
|
85
|
+
- bjmllr@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions:
|
88
|
+
- ext/unnatural/extconf.rb
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".travis.yml"
|
93
|
+
- CODE_OF_CONDUCT.md
|
94
|
+
- Gemfile
|
95
|
+
- LICENSE.txt
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- bin/console
|
99
|
+
- bin/setup
|
100
|
+
- ext/unnatural/extconf.rb
|
101
|
+
- ext/unnatural/fast_compare.c
|
102
|
+
- lib/unnatural.rb
|
103
|
+
- lib/unnatural/fast.rb
|
104
|
+
- lib/unnatural/scan.rb
|
105
|
+
- lib/unnatural/split.rb
|
106
|
+
- lib/unnatural/substitution.rb
|
107
|
+
- lib/unnatural/version.rb
|
108
|
+
- unnatural.gemspec
|
109
|
+
homepage: https://github.com/bjmllr/unnatural
|
110
|
+
licenses:
|
111
|
+
- MIT
|
112
|
+
metadata: {}
|
113
|
+
post_install_message:
|
114
|
+
rdoc_options: []
|
115
|
+
require_paths:
|
116
|
+
- lib
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
requirements: []
|
128
|
+
rubyforge_project:
|
129
|
+
rubygems_version: 2.5.1
|
130
|
+
signing_key:
|
131
|
+
specification_version: 4
|
132
|
+
summary: A natural sort.
|
133
|
+
test_files: []
|