ppcurses 0.0.24 → 0.0.25
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2f9ab141072907b3d6bc679c399c9e745e67222
|
4
|
+
data.tar.gz: 9eda65b014ddc47fecacc8c75bc5211484532489
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a55ebcc9d419770924382099751371cacdb0b9fa9cd8a2d8e7fc6cc35d2d432eb2d29087ce907aafea22e00bc78b16c9024b9cc7b42ddcece2fda5390aba0083
|
7
|
+
data.tar.gz: e0d8d21cdcb68e7699d2031e4ff3203c99275df40bbc7e745bf2e04b5e8a36edf7bc785e5ea414bb3efba8ace35021ecad1f17a5756eaf4159779ab0b4d3ed3d
|
@@ -29,7 +29,7 @@ class GetDataAction < BaseAction
|
|
29
29
|
def data
|
30
30
|
values = []
|
31
31
|
@actions.each do |action|
|
32
|
-
values.push(action.data
|
32
|
+
values.push( action.data )
|
33
33
|
end
|
34
34
|
values
|
35
35
|
end
|
@@ -45,18 +45,18 @@ class GetDataAction < BaseAction
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def execute
|
48
|
-
create_window
|
48
|
+
create_window
|
49
49
|
echo
|
50
50
|
|
51
|
-
@win.setpos(@win.cury,x_padding
|
51
|
+
@win.setpos(@win.cury, x_padding )
|
52
52
|
|
53
|
-
self.before_actions
|
53
|
+
self.before_actions
|
54
54
|
|
55
55
|
@actions.each do |action|
|
56
56
|
action.execute
|
57
57
|
end
|
58
58
|
|
59
|
-
self.after_actions
|
59
|
+
self.after_actions
|
60
60
|
|
61
61
|
noecho
|
62
62
|
@win.clear
|
@@ -65,9 +65,9 @@ class GetDataAction < BaseAction
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def print_line(string)
|
68
|
-
@win.setpos(@win.cury
|
68
|
+
@win.setpos(@win.cury, win_padding)
|
69
69
|
@win.addstr(string)
|
70
|
-
@win.setpos(@win.cury
|
70
|
+
@win.setpos(@win.cury + 1, win_padding)
|
71
71
|
end
|
72
72
|
|
73
73
|
def print_success_line(string)
|
@@ -11,7 +11,7 @@ module PPCurses
|
|
11
11
|
super(prompt)
|
12
12
|
|
13
13
|
# verify enumeration is an array
|
14
|
-
unless enumeration.respond_to?('each_with_index')
|
14
|
+
unless enumeration.respond_to?('each_with_index')
|
15
15
|
raise
|
16
16
|
end
|
17
17
|
|
@@ -23,7 +23,7 @@ module PPCurses
|
|
23
23
|
super()
|
24
24
|
@options.each_with_index do |option, index|
|
25
25
|
@win.addstr(option)
|
26
|
-
if index == @current_option
|
26
|
+
if index == @current_option
|
27
27
|
@win.addstr(' [X] ')
|
28
28
|
else
|
29
29
|
@win.addstr(' [ ] ')
|
@@ -33,7 +33,7 @@ module PPCurses
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def execute
|
36
|
-
print_prompt
|
36
|
+
print_prompt
|
37
37
|
# Enables reading arrow keys in getch
|
38
38
|
@win.keypad(true)
|
39
39
|
while 1
|
@@ -41,19 +41,19 @@ module PPCurses
|
|
41
41
|
c = @win.getch
|
42
42
|
|
43
43
|
if c == KEY_LEFT then @current_option = @current_option-1 end
|
44
|
-
if c == KEY_RIGHT then @current_option= @current_option+1 end
|
44
|
+
if c == KEY_RIGHT then @current_option = @current_option+1 end
|
45
45
|
if c == 10 then break end
|
46
46
|
|
47
47
|
if @current_option < 0 then @current_option = @options.length-1 end
|
48
48
|
if @current_option > @options.length-1 then @current_option = 0 end
|
49
49
|
|
50
50
|
echo
|
51
|
-
print_prompt
|
51
|
+
print_prompt
|
52
52
|
end
|
53
53
|
echo
|
54
54
|
# Go to next line so that further actions to overwrite
|
55
55
|
# the choice
|
56
|
-
@win.setpos(@win.cury
|
56
|
+
@win.setpos(@win.cury + 1, x_padding)
|
57
57
|
end
|
58
58
|
|
59
59
|
def data
|
@@ -6,17 +6,17 @@ module PPCurses
|
|
6
6
|
class GetIntegerAction < PromptAction
|
7
7
|
|
8
8
|
def execute
|
9
|
-
y = @win.cury
|
9
|
+
y = @win.cury
|
10
10
|
@data = ''
|
11
|
-
begin
|
12
|
-
@win.setpos(y,x_padding
|
13
|
-
@win.clrtoeol
|
11
|
+
begin
|
12
|
+
@win.setpos(y, x_padding)
|
13
|
+
@win.clrtoeol
|
14
14
|
@win.box('|', '-')
|
15
15
|
@win.addstr(@prompt)
|
16
16
|
echo
|
17
|
-
@data = @win.getstr
|
17
|
+
@data = @win.getstr
|
18
18
|
noecho
|
19
|
-
end
|
19
|
+
end until @data =~ /^\d+$/
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ppcurses
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthieu Cormier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Curses abstraction
|
14
14
|
email: mcormier@preenandprune.com
|