sentino 0.2.0 → 0.2.1
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/VERSION +1 -1
- data/lib/sentino/pattern.rb +1 -2
- data/sentino.gemspec +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d248961bc584b3dd5908477776a03126337a822b
|
4
|
+
data.tar.gz: 02134d3edbb165f9b1cb3b25f59e1e2f34007226
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8651282b7b1d78f89a084def4e353da86d069bfbff835137817a102bb2212fe747b50f45b12c961ea3a0511c09658c44cdc08c40be6b4c14eb3e8565d961485
|
7
|
+
data.tar.gz: 092d68aaaa736fbff7e88f510fa7ec67cd48b63adfbc0737ec264d488e50e4ebc85399b7d8e11db8e38017b105b2cc7087f76a2e193c61ad07c31b819723cf63
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/sentino/pattern.rb
CHANGED
@@ -40,14 +40,13 @@ private
|
|
40
40
|
for mathcer in @reference
|
41
41
|
counts << count_matchings(string, mathcer)
|
42
42
|
end
|
43
|
-
puts counts
|
44
43
|
total_length = counts.map{|x| x == 0 ? 1 : x}.reduce(:+)
|
45
44
|
matching_length = counts.reduce(:+)
|
46
45
|
matching_length.to_f/total_length.to_f
|
47
46
|
end
|
48
47
|
|
49
48
|
def count_matchings(string, substring)
|
50
|
-
string.scan(/(?=#{substring})/).count
|
49
|
+
string.scan(/(?=#{Regexp.quote(substring)})/).count
|
51
50
|
end
|
52
51
|
|
53
52
|
end
|
data/sentino.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: sentino 0.2.
|
5
|
+
# stub: sentino 0.2.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "sentino"
|
9
|
-
s.version = "0.2.
|
9
|
+
s.version = "0.2.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|