kmp 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +2 -0
- data/.gitignore +14 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/AUTHORS +1 -0
- data/CHANGELOG.md +3 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/CONTRIBUTING.md +17 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +56 -0
- data/LICENSE.txt +21 -0
- data/README.md +58 -0
- data/Rakefile +12 -0
- data/banch_mark.rb +19 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ext/kmp/extconf.rb +3 -0
- data/ext/kmp/kmp.c +14 -0
- data/ext/kmp/kmp_string.c +106 -0
- data/ext/kmp/kmp_string.h +7 -0
- data/kmp.gemspec +40 -0
- data/lib/kmp.rb +3 -0
- data/lib/kmp/kmp.so +0 -0
- data/lib/kmp/string.rb +7 -0
- data/lib/kmp/version.rb +3 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e04c7a5db40803de18e97fc8a9344333a24564c7
|
4
|
+
data.tar.gz: 3e84aa406dde540db0777c52ac910937f392c150
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8378a07e3ef333d753997415784b82839bcf33a6792d9ed2aba9299fbd63c23ca2559d62e326282589a852caefec5752615068928ac147065ae25d8179193317
|
7
|
+
data.tar.gz: 3f012d995f4e9d71bf4be6a01490ce075e52505a8cfa5e474169d4d2965406b01158992fca3b7635e3657f6d938a21bd8271dd239595bcd7056d7c44f5a9f15a
|
data/.coveralls.yml
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/AUTHORS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Tanvir Hasan
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at tanvir002700@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Contribution Guidelines
|
2
|
+
|
3
|
+
## Steps
|
4
|
+
|
5
|
+
1. Fork [the repo](https://github.com/tanvir002700/kmp)
|
6
|
+
2. Grab dependencies: `bundle install`
|
7
|
+
3. Make sure everything is working: `bundle exec rake spec`
|
8
|
+
4. Make your changes
|
9
|
+
5. Run your local from bin/console
|
10
|
+
6. Test your changes
|
11
|
+
7. Create a Pull Request
|
12
|
+
8. Celebrate!!!!!
|
13
|
+
|
14
|
+
## Notes
|
15
|
+
|
16
|
+
When contributing, please make sure to update the AUTHORS file
|
17
|
+
when you submit your pull request.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
kmp (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
coveralls (0.8.21)
|
10
|
+
json (>= 1.8, < 3)
|
11
|
+
simplecov (~> 0.14.1)
|
12
|
+
term-ansicolor (~> 1.3)
|
13
|
+
thor (~> 0.19.4)
|
14
|
+
tins (~> 1.6)
|
15
|
+
diff-lcs (1.3)
|
16
|
+
docile (1.1.5)
|
17
|
+
json (2.1.0)
|
18
|
+
rake (10.5.0)
|
19
|
+
rake-compiler (1.0.4)
|
20
|
+
rake
|
21
|
+
rspec (3.7.0)
|
22
|
+
rspec-core (~> 3.7.0)
|
23
|
+
rspec-expectations (~> 3.7.0)
|
24
|
+
rspec-mocks (~> 3.7.0)
|
25
|
+
rspec-core (3.7.1)
|
26
|
+
rspec-support (~> 3.7.0)
|
27
|
+
rspec-expectations (3.7.0)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.7.0)
|
30
|
+
rspec-mocks (3.7.0)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.7.0)
|
33
|
+
rspec-support (3.7.0)
|
34
|
+
simplecov (0.14.1)
|
35
|
+
docile (~> 1.1.0)
|
36
|
+
json (>= 1.8, < 3)
|
37
|
+
simplecov-html (~> 0.10.0)
|
38
|
+
simplecov-html (0.10.2)
|
39
|
+
term-ansicolor (1.6.0)
|
40
|
+
tins (~> 1.0)
|
41
|
+
thor (0.19.4)
|
42
|
+
tins (1.16.3)
|
43
|
+
|
44
|
+
PLATFORMS
|
45
|
+
ruby
|
46
|
+
|
47
|
+
DEPENDENCIES
|
48
|
+
bundler (~> 1.16)
|
49
|
+
coveralls (~> 0.8.21)
|
50
|
+
kmp!
|
51
|
+
rake (~> 10.0)
|
52
|
+
rake-compiler (~> 1.0, >= 1.0.0)
|
53
|
+
rspec (~> 3.0)
|
54
|
+
|
55
|
+
BUNDLED WITH
|
56
|
+
1.16.0
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 tanvir hasan
|
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,58 @@
|
|
1
|
+
# Kmp
|
2
|
+
[![Build Status](https://travis-ci.org/tanvir002700/kmp.svg?branch=master)](https://travis-ci.org/tanvir002700/kmp)
|
3
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/69f40101eeb294c05163/maintainability)](https://codeclimate.com/github/tanvir002700/kmp/maintainability)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/github/tanvir002700/kmp/badge.svg?branch=master)](https://coveralls.io/github/tanvir002700/kmp?branch=master)
|
5
|
+
[![GitHub last commit (branch)](https://img.shields.io/github/last-commit/tanvir002700/kmp/master.svg)](https://github.com/tanvir002700/kmp)
|
6
|
+
[![license](https://img.shields.io/github/license/tanvir002700/kmp.svg)](https://github.com/tanvir002700/kmp/blob/master/LICENSE)
|
7
|
+
|
8
|
+
This gem is KMP (Knuth–Morris–Pratt algorithm) implemantation with c Extension.
|
9
|
+
A super first substring find technique in a big string.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'kmp'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install kmp
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
``` ruby
|
30
|
+
require 'kmp'
|
31
|
+
k = Kmp::String.new 'abcdeab'
|
32
|
+
k.match 'ab' #=> [0, 4]
|
33
|
+
|
34
|
+
k.length #=> 7
|
35
|
+
```
|
36
|
+
|
37
|
+
## Complexity
|
38
|
+
|
39
|
+
- match function complexity O(N+M), N original text string length, M match string length
|
40
|
+
- length complexity O(1)
|
41
|
+
|
42
|
+
## Development
|
43
|
+
|
44
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. For compile c extension run `rake compile`.
|
45
|
+
|
46
|
+
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).
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tanvir002700/kmp. 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.
|
51
|
+
|
52
|
+
## License
|
53
|
+
|
54
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
55
|
+
|
56
|
+
## Code of Conduct
|
57
|
+
|
58
|
+
Everyone interacting in the Kmp project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/tanvir002700/kmp/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/banch_mark.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "kmp"
|
5
|
+
|
6
|
+
#(0...50).map { ('a'..'z').to_a[rand(26)] }.join
|
7
|
+
txt = ''
|
8
|
+
10000.times{txt << 'abc'}
|
9
|
+
|
10
|
+
t1 = Time.now
|
11
|
+
a = Kmp::String.new txt
|
12
|
+
b = a.match 'abcabcabcabcabcabc'
|
13
|
+
puts Time.now - t1
|
14
|
+
puts b.length
|
15
|
+
|
16
|
+
t1 = Time.now
|
17
|
+
b = txt.enum_for(:scan, /(?=abcabcabcabcabcabc)/).map { Regexp.last_match.offset(0).first }
|
18
|
+
puts Time.now - t1
|
19
|
+
puts b.size
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "kmp"
|
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(__FILE__)
|
data/bin/setup
ADDED
data/ext/kmp/extconf.rb
ADDED
data/ext/kmp/kmp.c
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#include<ruby.h>
|
2
|
+
#include<kmp_string.h>
|
3
|
+
|
4
|
+
static VALUE hello_world(VALUE klass)
|
5
|
+
{
|
6
|
+
return rb_str_new2("hello world");
|
7
|
+
}
|
8
|
+
|
9
|
+
void Init_kmp()
|
10
|
+
{
|
11
|
+
VALUE mKmp = rb_define_module("Kmp");
|
12
|
+
rb_define_singleton_method(mKmp, "hello_world", hello_world, 0);
|
13
|
+
Init_kmp_string(mKmp);
|
14
|
+
}
|
@@ -0,0 +1,106 @@
|
|
1
|
+
#include<ruby.h>
|
2
|
+
#include<string.h>
|
3
|
+
|
4
|
+
struct Str
|
5
|
+
{
|
6
|
+
char * ptr;
|
7
|
+
};
|
8
|
+
|
9
|
+
static void deallocate(struct Str *str)
|
10
|
+
{
|
11
|
+
free(str);
|
12
|
+
}
|
13
|
+
|
14
|
+
static VALUE allocate(VALUE klass)
|
15
|
+
{
|
16
|
+
struct Str * str = (struct Str *)malloc(sizeof(struct Str));
|
17
|
+
|
18
|
+
VALUE obj = Data_Make_Struct(klass, struct Str, NULL, deallocate, str);
|
19
|
+
str->ptr = NULL;
|
20
|
+
return obj;
|
21
|
+
}
|
22
|
+
|
23
|
+
static VALUE initialize(VALUE self, VALUE rb_string)
|
24
|
+
{
|
25
|
+
struct Str * str;
|
26
|
+
|
27
|
+
Check_Type(rb_string, T_STRING);
|
28
|
+
Data_Get_Struct(self, struct Str, str);
|
29
|
+
|
30
|
+
str->ptr = calloc(RSTRING_LEN(rb_string) , sizeof(char));
|
31
|
+
memcpy(str->ptr, StringValuePtr(rb_string), RSTRING_LEN(rb_string));
|
32
|
+
|
33
|
+
rb_iv_set(self, "@str", rb_string);
|
34
|
+
rb_iv_set(self, "@length", INT2NUM(RSTRING_LEN(rb_string)));
|
35
|
+
|
36
|
+
return self;
|
37
|
+
}
|
38
|
+
|
39
|
+
static int* compute_prefix(char *str)
|
40
|
+
{
|
41
|
+
int len = strlen(str);
|
42
|
+
|
43
|
+
int * prefix;
|
44
|
+
prefix = calloc(len+1, sizeof(int));
|
45
|
+
|
46
|
+
prefix[0] = -1;
|
47
|
+
int k = -1;
|
48
|
+
|
49
|
+
for(int i=1; i<len; i++)
|
50
|
+
{
|
51
|
+
while( k>-1 && str[k+1]!=str[i] ) k = prefix[k];
|
52
|
+
if( str[k+1] == str[i] ) k = k+1;
|
53
|
+
prefix[i] = k;
|
54
|
+
}
|
55
|
+
return prefix;
|
56
|
+
}
|
57
|
+
|
58
|
+
static VALUE match(VALUE self, VALUE rb_str)
|
59
|
+
{
|
60
|
+
VALUE positions = rb_ary_new();
|
61
|
+
struct Str * obj;
|
62
|
+
char * str;
|
63
|
+
char * ptrn;
|
64
|
+
int * prefix;
|
65
|
+
|
66
|
+
Data_Get_Struct(self, struct Str, obj);
|
67
|
+
str = calloc(strlen(obj->ptr), sizeof(char));
|
68
|
+
strcpy(str, obj->ptr);
|
69
|
+
|
70
|
+
ptrn = calloc(RSTRING_LEN(rb_str), sizeof(char));
|
71
|
+
memcpy(ptrn, StringValuePtr(rb_str), RSTRING_LEN(rb_str));
|
72
|
+
|
73
|
+
prefix = compute_prefix(ptrn);
|
74
|
+
|
75
|
+
int n = strlen(str);
|
76
|
+
int m = strlen(ptrn);
|
77
|
+
|
78
|
+
int q = -1;
|
79
|
+
for(int i=0; i<n; i++)
|
80
|
+
{
|
81
|
+
while( q>-1 && ptrn[q+1]!=str[i] ) q = prefix[q];
|
82
|
+
if( ptrn[q+1]==str[i] ) q = q+1;
|
83
|
+
if( q==m-1 )
|
84
|
+
{
|
85
|
+
rb_ary_push(positions, INT2NUM(i-m+1));
|
86
|
+
q = prefix[q];
|
87
|
+
}
|
88
|
+
}
|
89
|
+
free(prefix);
|
90
|
+
free(ptrn);
|
91
|
+
free(str);
|
92
|
+
|
93
|
+
return positions;
|
94
|
+
}
|
95
|
+
|
96
|
+
void Init_kmp_string(VALUE mKmp)
|
97
|
+
{
|
98
|
+
VALUE cKmpString = rb_define_class_under(mKmp, "String", rb_cObject);
|
99
|
+
|
100
|
+
rb_define_alloc_func(cKmpString, allocate);
|
101
|
+
rb_define_method(cKmpString, "initialize", initialize, 1);
|
102
|
+
rb_define_method(cKmpString, "match", match, 1);
|
103
|
+
rb_define_attr(cKmpString, "str", 1, 0);
|
104
|
+
rb_define_attr(cKmpString, "length", 1, 0);
|
105
|
+
}
|
106
|
+
|
data/kmp.gemspec
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "kmp/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "kmp"
|
8
|
+
spec.version = Kmp::VERSION
|
9
|
+
spec.authors = ["tanvir hasan"]
|
10
|
+
spec.email = ["tanvir002700@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Kmp algorithm implementation with c extension in ruby.}
|
13
|
+
spec.description = %q{A string matching algorithm wants to find the starting index m in string S[] that matches the search word W[].}
|
14
|
+
spec.homepage = "https://rubygems.org/gems/kmp"
|
15
|
+
spec.license = "MIT"
|
16
|
+
spec.metadata = { 'source_code_uri' => 'https://github.com/tanvir002700/kmp' }
|
17
|
+
|
18
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
19
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
20
|
+
if spec.respond_to?(:metadata)
|
21
|
+
spec.metadata["allowed_push_host"] = 'https://rubygems.org'
|
22
|
+
else
|
23
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
24
|
+
"public gem pushes."
|
25
|
+
end
|
26
|
+
|
27
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
28
|
+
f.match(%r{^(test|spec|features)/})
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
35
|
+
spec.add_development_dependency 'coveralls', '~> 0.8.21'
|
36
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
37
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
38
|
+
spec.add_development_dependency 'rake-compiler', '~> 1.0', '>= 1.0.0'
|
39
|
+
spec.extensions = %w[ext/kmp/extconf.rb]
|
40
|
+
end
|
data/lib/kmp.rb
ADDED
data/lib/kmp/kmp.so
ADDED
Binary file
|
data/lib/kmp/string.rb
ADDED
data/lib/kmp/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kmp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- tanvir hasan
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-02 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: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: coveralls
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.8.21
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.8.21
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake-compiler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.0'
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 1.0.0
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - "~>"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '1.0'
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 1.0.0
|
89
|
+
description: A string matching algorithm wants to find the starting index m in string
|
90
|
+
S[] that matches the search word W[].
|
91
|
+
email:
|
92
|
+
- tanvir002700@gmail.com
|
93
|
+
executables: []
|
94
|
+
extensions:
|
95
|
+
- ext/kmp/extconf.rb
|
96
|
+
extra_rdoc_files: []
|
97
|
+
files:
|
98
|
+
- ".coveralls.yml"
|
99
|
+
- ".gitignore"
|
100
|
+
- ".rspec"
|
101
|
+
- ".travis.yml"
|
102
|
+
- AUTHORS
|
103
|
+
- CHANGELOG.md
|
104
|
+
- CODE_OF_CONDUCT.md
|
105
|
+
- CONTRIBUTING.md
|
106
|
+
- Gemfile
|
107
|
+
- Gemfile.lock
|
108
|
+
- LICENSE.txt
|
109
|
+
- README.md
|
110
|
+
- Rakefile
|
111
|
+
- banch_mark.rb
|
112
|
+
- bin/console
|
113
|
+
- bin/setup
|
114
|
+
- ext/kmp/extconf.rb
|
115
|
+
- ext/kmp/kmp.c
|
116
|
+
- ext/kmp/kmp_string.c
|
117
|
+
- ext/kmp/kmp_string.h
|
118
|
+
- kmp.gemspec
|
119
|
+
- lib/kmp.rb
|
120
|
+
- lib/kmp/kmp.so
|
121
|
+
- lib/kmp/string.rb
|
122
|
+
- lib/kmp/version.rb
|
123
|
+
homepage: https://rubygems.org/gems/kmp
|
124
|
+
licenses:
|
125
|
+
- MIT
|
126
|
+
metadata:
|
127
|
+
source_code_uri: https://github.com/tanvir002700/kmp
|
128
|
+
allowed_push_host: https://rubygems.org
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 2.6.11
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: Kmp algorithm implementation with c extension in ruby.
|
149
|
+
test_files: []
|