pry-coolline 0.2.1 → 0.2.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.
- data/lib/pry-coolline.rb +3 -21
- data/lib/pry-coolline/version.rb +1 -1
- data/lib/pry-coolline/wrapper.rb +45 -0
- metadata +3 -2
data/lib/pry-coolline.rb
CHANGED
@@ -11,28 +11,10 @@ Pry.config.coolline_mismatched_paren ||= "\e[41m"
|
|
11
11
|
|
12
12
|
begin
|
13
13
|
require 'coolline'
|
14
|
-
require 'pry-coolline/paren_match'
|
15
|
-
|
16
|
-
Pry.config.input = Coolline.new do |cool|
|
17
|
-
cool.word_boundaries = [" ", "\t", ",", ";", '"', "'", "`", "<", ">",
|
18
|
-
"=", ";", "|", "{", "}", "(", ")", "-"]
|
19
|
-
|
20
|
-
# bring saved history into coolline
|
21
|
-
cool.history_file = File.expand_path(Pry.config.history.file)
|
22
14
|
|
23
|
-
|
24
|
-
|
25
|
-
code = CodeRay.scan(cool.line, :ruby).term
|
26
|
-
|
27
|
-
if Pry.config.coolline_paren_matching
|
28
|
-
PryCoolline.apply_paren_matching(code, cool.pos)
|
29
|
-
end
|
15
|
+
require 'pry-coolline/paren_match'
|
16
|
+
require 'pry-coolline/wrapper'
|
30
17
|
|
31
|
-
|
32
|
-
else
|
33
|
-
cool.line
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
18
|
+
Pry.config.input = PryCoolline.make_input
|
37
19
|
rescue LoadError
|
38
20
|
end if ENV["TERM"] != "dumb"
|
data/lib/pry-coolline/version.rb
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
module PryCoolline
|
2
|
+
Wrapper = Struct.new(:cool) do
|
3
|
+
def readline(prompt)
|
4
|
+
cool.readline prompt
|
5
|
+
end
|
6
|
+
|
7
|
+
def completion_proc=(proc)
|
8
|
+
cool.completion_proc = proc do
|
9
|
+
proc.call cool.completed_word
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
module_function
|
15
|
+
|
16
|
+
# @return [Coolline]
|
17
|
+
def make_coolline
|
18
|
+
Coolline.new do |cool|
|
19
|
+
cool.word_boundaries = [" ", "\t", ",", ";", '"', "'", "`", "<", ">",
|
20
|
+
"=", ";", "|", "{", "}", "(", ")", "-"]
|
21
|
+
|
22
|
+
# bring saved history into coolline
|
23
|
+
cool.history_file = File.expand_path(Pry.config.history.file)
|
24
|
+
|
25
|
+
cool.transform_proc = proc do
|
26
|
+
if Pry.color
|
27
|
+
code = CodeRay.scan(cool.line, :ruby).term
|
28
|
+
|
29
|
+
if Pry.config.coolline_paren_matching
|
30
|
+
PryCoolline.apply_paren_matching(code, cool.pos)
|
31
|
+
end
|
32
|
+
|
33
|
+
code
|
34
|
+
else
|
35
|
+
cool.line
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [Wrapper] An object usable as an input object for Pry.
|
42
|
+
def make_input
|
43
|
+
Wrapper.new make_coolline
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-coolline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: coolline
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- lib/pry-coolline.rb
|
76
76
|
- lib/pry-coolline/paren_match.rb
|
77
77
|
- lib/pry-coolline/version.rb
|
78
|
+
- lib/pry-coolline/wrapper.rb
|
78
79
|
- pry-coolline.gemspec
|
79
80
|
- test/helpers.rb
|
80
81
|
- test/paren_match_test.rb
|