highline 2.0.0.pre.develop.15 → 2.0.0.pre.develop.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +4 -0
- data/lib/highline.rb +19 -2
- data/lib/highline/list_renderer.rb +5 -1
- data/lib/highline/menu.rb +8 -2
- data/lib/highline/question.rb +5 -1
- data/lib/highline/statement.rb +5 -1
- data/lib/highline/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d1af4546ccbd56901aee7db32d287c0a599a2ae06cb96d5ab4e10293735c0c0
|
4
|
+
data.tar.gz: 167e3f5567b04dcc76a0276b0596800bfb0c67c33b22d8abff6f897789d33edd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4c016dfdd3d1d3af5e81747597d20166886c26bc8713855238c947ecdd71c80e425759273b6624c3c3ed2c90dac07e770e380d8d6ce058ed3c61bfad6109c57
|
7
|
+
data.tar.gz: cf388f1550ade7cbcd06477dda3d550e11b45089d1959aedea57849dc76d9424b21024743e76cbaa646e59a7b6d01fccfe8bbe1e73f5570648676a15a199127b
|
data/Changelog.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
Below is a complete listing of changes for each revision of HighLine.
|
4
4
|
|
5
|
+
### 2.0.0-develop.16 / 2018-05-12
|
6
|
+
* PR #231 - Deprecate safe_level of ERB.new in Ruby 2.6 (@koic)
|
7
|
+
* PR #230 - Fix behavior when shell and gather options are selected together
|
8
|
+
|
5
9
|
### 2.0.0-develop.15 / 2017-12-28
|
6
10
|
* PR #229 - Update .travis.yml. Add Ruby 2.5 to matrix (@abinoam)
|
7
11
|
|
data/lib/highline.rb
CHANGED
@@ -257,7 +257,16 @@ class HighLine
|
|
257
257
|
return unless selected
|
258
258
|
|
259
259
|
if menu.shell
|
260
|
-
|
260
|
+
if menu.gather
|
261
|
+
selection = []
|
262
|
+
details = []
|
263
|
+
selected.each do |value|
|
264
|
+
selection << value[0]
|
265
|
+
details << value[1]
|
266
|
+
end
|
267
|
+
else
|
268
|
+
selection, details = selected
|
269
|
+
end
|
261
270
|
else
|
262
271
|
selection = selected
|
263
272
|
end
|
@@ -533,9 +542,11 @@ class HighLine
|
|
533
542
|
break if ["\n", "\r"].include? character
|
534
543
|
|
535
544
|
# honor backspace and delete
|
536
|
-
if character == "\b"
|
545
|
+
if character == "\b" || character == "\u007F"
|
537
546
|
chopped = line.chop!
|
538
547
|
output_erase_char if chopped && question.echo
|
548
|
+
elsif character == "\e"
|
549
|
+
ignore_arrow_key
|
539
550
|
else
|
540
551
|
line << character
|
541
552
|
say_last_char_or_echo_char(line, question)
|
@@ -561,6 +572,12 @@ class HighLine
|
|
561
572
|
end
|
562
573
|
end
|
563
574
|
|
575
|
+
def ignore_arrow_key
|
576
|
+
2.times do
|
577
|
+
terminal.get_character
|
578
|
+
end
|
579
|
+
end
|
580
|
+
|
564
581
|
def say_last_char_or_echo_char(line, question)
|
565
582
|
@output.print(line[-1]) if question.echo == true
|
566
583
|
@output.print(question.echo) if question.echo && question.echo != true
|
@@ -92,7 +92,11 @@ class HighLine
|
|
92
92
|
def render_list_items(items)
|
93
93
|
items.to_ary.map do |item|
|
94
94
|
item = String(item)
|
95
|
-
template = ERB.
|
95
|
+
template = if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
|
96
|
+
ERB.new(item, trim_mode: "%")
|
97
|
+
else
|
98
|
+
ERB.new(item, nil, "%")
|
99
|
+
end
|
96
100
|
template_renderer =
|
97
101
|
HighLine::TemplateRenderer.new(template, self, highline)
|
98
102
|
template_renderer.render
|
data/lib/highline/menu.rb
CHANGED
@@ -472,16 +472,22 @@ class HighLine
|
|
472
472
|
selected_items = selections.map do |selection|
|
473
473
|
find_item_from_selection(items, selection)
|
474
474
|
end
|
475
|
+
index = 0
|
475
476
|
selected_items.map do |selected_item|
|
476
|
-
value_for_selected_item(selected_item, details)
|
477
|
+
value = value_for_selected_item(selected_item, self.shell ? details[index] : nil)
|
478
|
+
index += 1
|
479
|
+
value
|
477
480
|
end
|
478
481
|
end
|
479
482
|
|
480
483
|
def value_for_hash_selections(items, selections, details)
|
481
484
|
# Find the selected items and return in hash form
|
485
|
+
index = 0
|
482
486
|
selections.each_with_object({}) do |(key, selection), memo|
|
483
487
|
selected_item = find_item_from_selection(items, selection)
|
484
|
-
|
488
|
+
value = value_for_selected_item(selected_item, self.shell ? details[index] : nil)
|
489
|
+
index += 1
|
490
|
+
memo[key] = value
|
485
491
|
end
|
486
492
|
end
|
487
493
|
|
data/lib/highline/question.rb
CHANGED
@@ -548,7 +548,11 @@ class HighLine
|
|
548
548
|
else
|
549
549
|
# evaluate ERb under initial scope, so it will have
|
550
550
|
# access to question and answer
|
551
|
-
template = ERB.
|
551
|
+
template = if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
|
552
|
+
ERB.new(confirm, trim_mode: "%")
|
553
|
+
else
|
554
|
+
ERB.new(confirm, nil, "%")
|
555
|
+
end
|
552
556
|
template_renderer = TemplateRenderer.new(template, self, highline)
|
553
557
|
template_renderer.render
|
554
558
|
end
|
data/lib/highline/statement.rb
CHANGED
@@ -78,7 +78,11 @@ class HighLine
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def template
|
81
|
-
@template ||= ERB.
|
81
|
+
@template ||= if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
|
82
|
+
ERB.new(template_string, trim_mode: "%")
|
83
|
+
else
|
84
|
+
ERB.new(template_string, nil, "%")
|
85
|
+
end
|
82
86
|
end
|
83
87
|
end
|
84
88
|
end
|
data/lib/highline/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: highline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.pre.develop.
|
4
|
+
version: 2.0.0.pre.develop.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Edward Gray II
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|