pxindex 0.1.1 → 0.1.2

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
2
  SHA1:
3
- metadata.gz: aa8e72a6b88709e91b08b64c3b69a6555d0bde8b
4
- data.tar.gz: e7f0839043b1ed3db016c13e298bb7c19b3e9c66
3
+ metadata.gz: 77bf21e2e1c1408b7b120bf424115534d620bf43
4
+ data.tar.gz: 157ae6bd91e88fca8ce19df89c14759518836569
5
5
  SHA512:
6
- metadata.gz: 377ef810ad44ba95317d470f74bef51f3e40cf4b02ae7e6429f2baaa92e549dad20f4efbe30befa1838c0ae640dee92df67e7f93cc86f46d8ca91f96907b8a2c
7
- data.tar.gz: 9c506a295da08a6e25a029dbec93b00889868204ba39f95931af74820ce97f9fb316796c0f7f68240caf48d55b55194e7a4e19add4006ac7e3dce31ce666f7de
6
+ metadata.gz: bee12c0ac40b5443f8d07773ac3847a326942f1bb0b98bfcdf54702ebfaf53525e75d4a577fb9a76086fc31b8ece75726dade735764c12202ececb42fe22a1e8
7
+ data.tar.gz: 6032bf8b5efc45f4f54f1dabe941bf0640377a48db68473e13345be7f869ab20f56e7276bf86e8c9a3d03e3846110a7a4b71f5179364d0a59cb7fd13f5089e28
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/pxindex.rb CHANGED
@@ -7,8 +7,7 @@ require 'polyrex-headings'
7
7
 
8
8
  class PxIndex
9
9
 
10
-
11
- def initialize(raw_s)
10
+ def initialize(raw_s, debug: false)
12
11
 
13
12
  s, _ = RXFHelper.read raw_s
14
13
 
@@ -16,18 +15,33 @@ class PxIndex
16
15
  @rs = @px.records
17
16
 
18
17
  @s = ''
18
+ @a = []
19
+ @debug = debug
19
20
 
20
21
  end
22
+
23
+ def parent()
24
+ @rs.first
25
+ end
21
26
 
22
27
  def q?(s)
23
-
24
- if (s.length - @s.length).abs > 1 or s[0..-2] != @s then
28
+
29
+ return @a.last if s == @s
30
+ puts '@s : ' + @s.inspect if @debug
31
+ puts 's: ' + s.inspect if @debug
32
+
33
+ # @s is used to store the previous string input to compare it with
34
+ # the new string input
35
+
36
+ if (s.length - @s.length).abs >= 1 or s[0..-2] != @s then
37
+
38
+ @s = s
25
39
 
26
40
  @rs = @px.records
27
41
 
28
42
  s2 = ''
29
43
 
30
- a = s.chars.map do |x|
44
+ @a = s.chars.map do |x|
31
45
 
32
46
  s2 += x
33
47
  found = search_records(s2, @rs)
@@ -36,19 +50,13 @@ class PxIndex
36
50
  found
37
51
 
38
52
  end
39
-
40
- return a ? a.last : nil
53
+
54
+ return @a ? @a.last : nil
41
55
 
42
56
  end
43
-
44
- i = s.length-1
45
-
46
- records = search_records(s, @rs)
47
-
48
- @s = s
49
-
50
- return records
51
-
57
+
58
+ return []
59
+
52
60
  end
53
61
 
54
62
  alias query q?
@@ -58,6 +66,7 @@ class PxIndex
58
66
 
59
67
  def search_records(raw_s, rs=@rs)
60
68
 
69
+ puts 'raw_s : ' + raw_s.inspect if @debug
61
70
 
62
71
  if raw_s[-1] == ' ' then
63
72
 
data.tar.gz.sig CHANGED
@@ -1 +1 @@
1
- N������}Qΰ�k����<Z�% xyh��Y�ZS_� ��:�o��W =��=3c��{�$D�Ϯ�s�쎨Tx;�6��k�1�/pݰK�U��t>n���8��g|���F bs�q�:Þ��I{��HʃwJ�Nj}h�~ oE7$3И�P*�x��o
1
+ ~�b��S.�@c�ܿ�EH̹�/+,)K5�.����kܤuV�*��=c�2he�Hn��Ҹ��U �������l7��dnJ1p(��볛�*Ct���no��`�*�oT��@�P�����u9����؃��1 ���`q������p�� |�Y��n����E�-`a Xz�eQA��D��Ն�K/��)y��|���q<���mBq y�Q��M�z��4x<�<@y7%U�7;I�H����ښ�L!�{
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pxindex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  MrilunBr0ny9pMGbDRKeTfgMh9LinxPgD3BjXqZ78prB3LDxWO8kA/yDt5sLGSiq
32
32
  n8uRSvQvGormuQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-12-01 00:00:00.000000000 Z
34
+ date: 2017-10-09 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: polyrex-headings
@@ -42,7 +42,7 @@ dependencies:
42
42
  version: '0.1'
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 0.1.5
45
+ version: 0.1.9
46
46
  type: :runtime
47
47
  prerelease: false
48
48
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,9 +52,9 @@ dependencies:
52
52
  version: '0.1'
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 0.1.5
55
+ version: 0.1.9
56
56
  description:
57
- email: james@r0bertson.co.uk
57
+ email: james@jamesrobertson.eu
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  version: '0'
81
81
  requirements: []
82
82
  rubyforge_project:
83
- rubygems_version: 2.5.1
83
+ rubygems_version: 2.6.13
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: Experimental gem to facilitate a keyword search, by querying a Polyrex document
metadata.gz.sig CHANGED
Binary file