command_search 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2547eed6e11ca87fb0673811fe0e71c8b46438cb4608973965bb8861519a5fe
4
- data.tar.gz: 0b89c973dbb4a2ee846bed3b3a8fd68de382db2a1ba3bab8a75ca29bb8803e87
3
+ metadata.gz: a0fcd48aa860c52997a4d321cbd60da14cf1655a7def93428da30ab593992a25
4
+ data.tar.gz: '093079892f0bb5dfeb7dc0e041349e106a791a4e0dfcc94a66fff0e4100c7058'
5
5
  SHA512:
6
- metadata.gz: cf30f8ae6d579a5c9be52aca78fb622b6a12f3ced8c431226e467b7917fe75c5f87f14527a3f69567529ec8413a4f2634bd252652198ba6caaa8b2b0e2d6b972
7
- data.tar.gz: 631d41b06396eb6db76ce6338707ee53bef5ecc1a26f5667854ff583b42091fcde5e1ff2670ccd73659c0e683d572195706f8bf46d3d03ca390b8accc2b6572e
6
+ metadata.gz: 5d2638ace20b629f1e4ff71358e2573293d3e08c397a216479eefb3f5a995f50d84b14cfcfafbc1c4d8c76bb48a45cc8cb20a2aa300ac7f3dfca7809396ae3c8
7
+ data.tar.gz: db0bc500aa61bda6dcb1f28c29b1822b1fcfb0b712c708aecb4b4badfcd72b840f42c3a1e90ae60efa84784cc800ccf5e7372289b1dd2e8702dc57b5541dc054
@@ -29,7 +29,10 @@ module CommandSearch
29
29
  type = :paren
30
30
  when /^[<>]=?/
31
31
  type = :compare
32
- when /^\d*[^\d\s:)][^\s"'|:<>)(]*/
32
+ # when /^([^\s"|<>()]+):/
33
+ # match = Regexp.last_match[1]
34
+ # type = :command
35
+ when /^[^\s:"|<>()]+/
33
36
  type = :str
34
37
  when /^./
35
38
  type = :str
@@ -21,7 +21,7 @@ module CommandSearch
21
21
  out
22
22
  end
23
23
 
24
- def cluster(type, input, cluster_type = :binary)
24
+ def cluster!(type, input, cluster_type = :binary)
25
25
  binary = (cluster_type == :binary)
26
26
  out = input
27
27
  out = out[:value] while out.is_a?(Hash)
@@ -39,18 +39,18 @@ module CommandSearch
39
39
  value: val
40
40
  }
41
41
  end
42
- out.map do |x|
42
+ out.map! do |x|
43
43
  next x unless x[:type] == :nest
44
- x[:value] = cluster(type, x[:value], cluster_type)
44
+ x[:value] = cluster!(type, x[:value], cluster_type)
45
45
  x
46
46
  end
47
47
  end
48
48
 
49
- def unchain(type, input)
50
- input.each_index do |i|
51
- front = input.dig(i, :type)
52
- mid = input.dig(i + 1, :type)
53
- back = input.dig(i + 2, :type)
49
+ def unchain!(type, input)
50
+ (input.length - 2).times do |i|
51
+ front = input[i][:type]
52
+ mid = input[i + 1][:type]
53
+ back = input[i + 2][:type]
54
54
  if front == type && mid != type && back == type
55
55
  input.insert(i + 1, input[i + 1])
56
56
  end
@@ -74,11 +74,11 @@ module CommandSearch
74
74
  def parse(input)
75
75
  out = input
76
76
  out = group_parens(out)
77
- out = cluster(:colon, out)
78
- out = unchain(:compare, out)
79
- out = cluster(:compare, out)
80
- out = cluster(:minus, out, :prefix)
81
- out = cluster(:pipe, out)
77
+ cluster!(:colon, out)
78
+ unchain!(:compare, out)
79
+ cluster!(:compare, out)
80
+ cluster!(:minus, out, :prefix)
81
+ cluster!(:pipe, out)
82
82
  out = clean_ununused_syntax(out)
83
83
  out
84
84
  end
metadata CHANGED
@@ -1,16 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: command_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - zumbalogy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-02 00:00:00.000000000 Z
12
- dependencies: []
13
- description: Query collections with ease and without an engine like Elasticsearch.
11
+ date: 2018-11-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: chronic
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.10.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.10.2
27
+ description: Build powerful and friendly search APIs for users.
14
28
  email:
15
29
  executables: []
16
30
  extensions: []
@@ -36,7 +50,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
36
50
  requirements:
37
51
  - - ">="
38
52
  - !ruby/object:Gem::Version
39
- version: '0'
53
+ version: 2.0.0
40
54
  required_rubygems_version: !ruby/object:Gem::Requirement
41
55
  requirements:
42
56
  - - ">="
@@ -44,8 +58,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
44
58
  version: '0'
45
59
  requirements: []
46
60
  rubyforge_project:
47
- rubygems_version: 2.7.7
61
+ rubygems_version: 3.0.0.beta1
48
62
  signing_key:
49
63
  specification_version: 4
50
- summary: A friendly search gem for users and developers.
64
+ summary: Let users query collections with ease.
51
65
  test_files: []