yap-shell-addon-tab-completion 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: 17f0d28a12033e862e37d1fb8cde3087567f02a8
4
- data.tar.gz: 931b2fecaad8de83abeb99f497f0d5eca0859a8e
3
+ metadata.gz: 59874fa16bbca399ba2459483e341c7e44ca7618
4
+ data.tar.gz: 7402b6b22d4a005fa69798249507f7622a6147fe
5
5
  SHA512:
6
- metadata.gz: 88a04ac6f611fd87a381ca5bcd8bea6f6a068257d524297826db1d40af302ab95bb19a64d05cc7092b19ae30265722b579f75c47c9249cda51a846f0655a6766
7
- data.tar.gz: df594f455eb5d59e4b27802edbea32ab0fdaeb10e4f2d5135a0a602a303fdc33113843f5165ac959efaa7dc1bb251673497ab69f8da789de670e10713b0b1ac2
6
+ metadata.gz: 101e598e009af9807bf4edddd7e418741a5501c9812ebf830669f1643a487db36c2afb680b6955c698df4b5908058ba7a84c2fbdb92b4cdc88223aa97d36182a
7
+ data.tar.gz: 8be38e89f879d35401d819baa5ba31c5ec18b95a84f504a7ea5224ac061990525254a4d27781f8df97c00d8ebc49aadd8e59e6cd2fadc73c42af6d71a5a4bc2b
@@ -1,6 +1,5 @@
1
1
  require 'yap/addon'
2
2
  require 'yap-shell-addon-tab-completion/basic_completion'
3
- require 'yap-shell-addon-tab-completion/completer'
4
3
  require 'yap-shell-addon-tab-completion/completion_result'
5
4
  require 'yap-shell-addon-tab-completion/custom_completion'
6
5
  require 'yap-shell-addon-tab-completion/dsl_methods'
@@ -1,3 +1,3 @@
1
1
  module YapShellAddonTabCompletion
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -17,8 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.executables = spec.files.grep(/^exe\//) { |f| File.basename(f) }
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_dependency "yap-shell", "~> 0.6"
21
-
20
+ spec.add_development_dependency "yap-shell-core", "~> 0.7.2"
22
21
  spec.add_development_dependency "bundler", "~> 1.12"
23
22
  spec.add_development_dependency "rake", "~> 11.2"
24
23
  spec.add_development_dependency "rspec", "~> 3.4"
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yap-shell-addon-tab-completion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Your name
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-01 00:00:00.000000000 Z
11
+ date: 2016-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: yap-shell
14
+ name: yap-shell-core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.6'
20
- type: :runtime
19
+ version: 0.7.2
20
+ type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.6'
26
+ version: 0.7.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -80,7 +80,6 @@ files:
80
80
  - Rakefile
81
81
  - lib/yap-shell-addon-tab-completion.rb
82
82
  - lib/yap-shell-addon-tab-completion/basic_completion.rb
83
- - lib/yap-shell-addon-tab-completion/completer.rb
84
83
  - lib/yap-shell-addon-tab-completion/completion_result.rb
85
84
  - lib/yap-shell-addon-tab-completion/custom_completion.rb
86
85
  - lib/yap-shell-addon-tab-completion/dsl_methods.rb
@@ -111,4 +110,3 @@ signing_key:
111
110
  specification_version: 4
112
111
  summary: tab-completion summary goes here.
113
112
  test_files: []
114
- has_rdoc:
@@ -1,61 +0,0 @@
1
- module YapShellAddonTabCompletion
2
- class Completer
3
- def initialize(char:, line:, completion:, completion_found:, completion_not_found:, done:)
4
- @completion_char = char
5
- @line = line
6
- @completion_proc = completion
7
- @completion_found_proc = completion_found
8
- @completion_not_found_proc = completion_not_found
9
- @done_proc = done
10
-
11
- @completion_matches = HistoryBuffer.new(0) do |h|
12
- h.duplicates = false
13
- h.cycle = true
14
- end
15
- @completion_matches.empty
16
-
17
- @first_time = true
18
- @word_start = @line.word[:start]
19
- end
20
-
21
- def read_bytes(bytes)
22
- return unless bytes.any?
23
-
24
- if bytes.map(&:ord) != @completion_char
25
- @done_proc.call(bytes)
26
- elsif @first_time
27
- matches = @completion_proc.call(sub_word) unless !@completion_proc || @completion_proc == []
28
- matches = matches.to_a.compact.sort.reverse
29
-
30
- if matches.any?
31
- @completion_matches.resize(matches.length)
32
- matches.each { |w| @completion_matches << w }
33
-
34
- # Get first match
35
- @completion_matches.back
36
- match = @completion_matches.get
37
-
38
- # completion matches is a history implementation and its in reverse order from what
39
- # a user would expect
40
- @completion_found_proc.call(completion: match, possible_completions: @completion_matches.reverse)
41
- else
42
- @completion_not_found_proc.call
43
- @done_proc.call
44
- end
45
- @first_time = false
46
- else
47
- @completion_matches.back
48
- match = @completion_matches.get
49
-
50
- @completion_found_proc.call(completion: match, possible_completions: @completion_matches.reverse)
51
- end
52
- end
53
-
54
- private
55
-
56
- def sub_word
57
- @line.text[@line.word[:start]..@line.position-1] || ""
58
- end
59
- end
60
-
61
- end