textoken 1.1.2 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7004ae776cfb6573966d5f175d772e22a680519e
4
- data.tar.gz: 6ca4c25db77fbac4045aecdfc60334e261c543aa
2
+ SHA256:
3
+ metadata.gz: b0cfe84f8bc1d0242712a0a18f783e6993dce951c979dd9ea0d8b49d907b23fb
4
+ data.tar.gz: b646571be4e46d9dbc422ab172ce43c83a1e176c9880aaec1c650c44636400ae
5
5
  SHA512:
6
- metadata.gz: a842fbc59192eb5a2e362dc9d5a51b18396c882dcd4e6d19f887a5112b9b31c485c17d3c266f6e90afc1b67267631f8cc6625035cebfe67920ae5ee38899246a
7
- data.tar.gz: e587756337e7f29cd249cdf97733e7fb24c52a85d2eeb37430ec4090717f0a69dd87744c918948dc62cbf9f07f416e56075d3132b60c04b1800d3b056c796a01
6
+ metadata.gz: b75953124e3f380841bcbeb851508c0377b793dbd87e41af1bfe86c0ac5963b7330b4013c6979541bef378d7aa017aefc46dfd50b12408394f3fe7e6e4cd253b
7
+ data.tar.gz: b756c2ccb9e1e4b657b6850530938c3d37046bc1b00c0b5858ee8b4e903e5c7ede165a7dea66b83a141618a81736b4ce0f97aa006035530167d2759385bd62dc
@@ -1,6 +1,7 @@
1
1
  require 'yaml'
2
2
 
3
3
  require 'textoken/version'
4
+ require 'textoken/compat'
4
5
  require 'textoken/base'
5
6
  require 'textoken/errors'
6
7
  require 'textoken/searcher'
@@ -0,0 +1 @@
1
+ IntClass = defined?(RUBY_VERSION) && RUBY_VERSION > "2.4" ? Integer : Fixnum
@@ -1,7 +1,4 @@
1
1
  module Textoken
2
- class ExpressionError < Exception
3
- end
4
-
5
- class TypeError < Exception
6
- end
2
+ ExpressionError = Class.new(StandardError)
3
+ TypeError = Class.new(StandardError)
7
4
  end
@@ -16,7 +16,7 @@ module Textoken
16
16
 
17
17
  # collection will return a sorted and unique array of tokens
18
18
  def collection
19
- @collection.uniq { |w| w[0].to_s + w[1] }.sort_by(&:first)
19
+ @collection.uniq { |w| "#{w[0]}#{w[1]}" }.sort_by(&:first)
20
20
  end
21
21
 
22
22
  # result will return a one dimensional array of words
@@ -27,7 +27,7 @@ module Textoken
27
27
  private
28
28
 
29
29
  def type_check(i, word)
30
- return if word.is_a?(String) && (i.is_a?(Fixnum) || i.is_a?(Float))
30
+ return if word.is_a?(String) && (i.is_a?(IntClass) || i.is_a?(Float))
31
31
  Textoken.type_err("#{word} and #{i} has to be a String and Integer")
32
32
  end
33
33
  end
@@ -25,7 +25,7 @@ module Textoken
25
25
  end
26
26
 
27
27
  def validate(&code)
28
- return if number.class == Fixnum && code.call(number)
28
+ return if number.class == IntClass && code.call(number)
29
29
  Textoken.expression_err "value #{number} is not permitted for
30
30
  #{self.class.name} option."
31
31
  end
@@ -19,7 +19,7 @@ module Textoken
19
19
 
20
20
  def partition(scan, word)
21
21
  scan.each do |p|
22
- word = word.gsub(p, ' ' + p + ' ')
22
+ word = word.gsub(p, " #{p} ")
23
23
  end
24
24
  word.split(' ')
25
25
  end
@@ -1,3 +1,3 @@
1
1
  module Textoken
2
- VERSION = "1.1.2"
2
+ VERSION = "1.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textoken
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mehmet Cetin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-09 00:00:00.000000000 Z
11
+ date: 2019-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -50,6 +50,7 @@ files:
50
50
  - Rakefile
51
51
  - lib/textoken.rb
52
52
  - lib/textoken/base.rb
53
+ - lib/textoken/compat.rb
53
54
  - lib/textoken/errors.rb
54
55
  - lib/textoken/factories/option_factory.rb
55
56
  - lib/textoken/findings.rb
@@ -88,10 +89,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
89
  - !ruby/object:Gem::Version
89
90
  version: '0'
90
91
  requirements: []
91
- rubyforge_project:
92
- rubygems_version: 2.5.1
92
+ rubygems_version: 3.0.3
93
93
  signing_key:
94
94
  specification_version: 4
95
95
  summary: Simple and customizable text tokenization gem.
96
96
  test_files: []
97
- has_rdoc: