webri 2.2.0 → 2.2.1
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 +4 -4
- data/lib/webri/version.rb +1 -1
- data/lib/webri.rb +24 -7
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ba0ef2db19e442871c35e15c179f5de35941e87e5ce1a3d4afe0e1df9c6e19c0
|
|
4
|
+
data.tar.gz: 03b7f263f09d1e02e83cc0a190f47e221c5dc7e5bb1b7487149520fbbb361655
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 863c5f457150c1ac329b767e899afb41e62ea2016095e72d29efb374c080f39cab6888b01cd32132651e1ce8adba108d3deed9efb20a532873debe4c4f8d50c4
|
|
7
|
+
data.tar.gz: 3cb5a5ff87a108a4e026764add4540af14327161004bee077272f52a64a2296e5056b7bd9706d5dbac8051a68956fa4b266d7c5fa89723dc1d2c806095658c60
|
data/lib/webri/version.rb
CHANGED
data/lib/webri.rb
CHANGED
|
@@ -422,13 +422,14 @@ class WebRI
|
|
|
422
422
|
|
|
423
423
|
# Present choices; return choice.
|
|
424
424
|
def get_choice_(choices, required: false)
|
|
425
|
+
lines = []
|
|
425
426
|
index = nil
|
|
426
427
|
range = (0..choices.size - 1)
|
|
427
428
|
until range.include?(index)
|
|
428
429
|
choices.each_with_index do |choice, i|
|
|
429
430
|
s = "%6d" % i
|
|
430
431
|
token = WebRI.token(choice)
|
|
431
|
-
|
|
432
|
+
lines << " #{s}: #{token}"
|
|
432
433
|
end
|
|
433
434
|
while true
|
|
434
435
|
message = if required
|
|
@@ -436,8 +437,24 @@ class WebRI
|
|
|
436
437
|
else
|
|
437
438
|
'Type a number to choose, or Return to skip: '
|
|
438
439
|
end
|
|
439
|
-
|
|
440
|
-
|
|
440
|
+
lines << message
|
|
441
|
+
s = lines.join("\n")
|
|
442
|
+
require "mkmf"
|
|
443
|
+
|
|
444
|
+
pager =
|
|
445
|
+
ENV["PAGER"] ||
|
|
446
|
+
if find_executable("less")
|
|
447
|
+
'less -RFX'
|
|
448
|
+
else
|
|
449
|
+
'more'
|
|
450
|
+
end
|
|
451
|
+
begin
|
|
452
|
+
IO.popen(pager, "w") do |io|
|
|
453
|
+
io.puts s
|
|
454
|
+
rescue Errno::EPIPE
|
|
455
|
+
# User exited early.
|
|
456
|
+
end
|
|
457
|
+
end
|
|
441
458
|
response = $stdin.gets
|
|
442
459
|
case response
|
|
443
460
|
when /(\d+)/
|
|
@@ -446,7 +463,7 @@ class WebRI
|
|
|
446
463
|
when "\n"
|
|
447
464
|
return nil unless required
|
|
448
465
|
else
|
|
449
|
-
|
|
466
|
+
# Continue
|
|
450
467
|
end
|
|
451
468
|
end
|
|
452
469
|
end
|
|
@@ -582,7 +599,7 @@ HELP
|
|
|
582
599
|
}
|
|
583
600
|
|
|
584
601
|
def self.ansi_color(s, color)
|
|
585
|
-
return s unless $stdout.tty?
|
|
602
|
+
# return s unless $stdout.tty?
|
|
586
603
|
"\e[#{ANSI_COLOR[color]}m#{s}\e[0m"
|
|
587
604
|
end
|
|
588
605
|
|
|
@@ -639,9 +656,9 @@ HELP
|
|
|
639
656
|
There are four types of #{WebRI.variable('name')}, as determined by prefixes:
|
|
640
657
|
|
|
641
658
|
|------------------|----------------|--------------------|
|
|
642
|
-
| Type |
|
|
659
|
+
| Type | Prefix | Example |
|
|
643
660
|
|------------------|----------------|--------------------|
|
|
644
|
-
| Class/module | Capital letter | #{WebRI.tokenq('Array')}
|
|
661
|
+
| Class/module | Capital letter | #{WebRI.tokenq('Array')} |
|
|
645
662
|
| Singleton method | #{WebRI.tokenq('::')} | #{WebRI.tokenq('::new')} |
|
|
646
663
|
| Instance method | #{WebRI.tokenq('#')} | #{WebRI.tokenq('#inspect')} |
|
|
647
664
|
| Ruby file | #{WebRI.tokenq('ruby:')} | #{WebRI.tokenq('ruby:syntax_rdoc')} |
|