dotime 0.0.7 → 0.0.8
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/History.txt +3 -0
- data/lib/do_time.rb +12 -15
- metadata +1 -1
data/History.txt
CHANGED
data/lib/do_time.rb
CHANGED
@@ -18,12 +18,12 @@ require File.dirname(__FILE__) + '/basecamp'
|
|
18
18
|
require 'optparse'
|
19
19
|
|
20
20
|
class DoTime
|
21
|
-
VERSION = '0.0.
|
21
|
+
VERSION = '0.0.8'
|
22
22
|
|
23
23
|
include HighLine::SystemExtensions
|
24
24
|
|
25
|
-
ENTER_KEY =
|
26
|
-
SPACE_KEY =
|
25
|
+
ENTER_KEY = RUBY_PLATFORM !~ /mswin32|mingw|cygwin|bccwin32|darwin/ ? "\n" : "\r"
|
26
|
+
SPACE_KEY = " "
|
27
27
|
|
28
28
|
BASIC_ACTIONS = [
|
29
29
|
['p', 'Select a different project','Select from a list of the active projects belonging to owner'],
|
@@ -85,8 +85,7 @@ class DoTime
|
|
85
85
|
actions = BASIC_ACTIONS
|
86
86
|
end
|
87
87
|
|
88
|
-
while /q/i !~ (char = show_todos_and_select_action(actions)
|
89
|
-
char = char.chr unless [ENTER_KEY, SPACE_KEY].include?(char)
|
88
|
+
while /q/i !~ (char = show_todos_and_select_action(actions).chr)
|
90
89
|
case char
|
91
90
|
when /p/i
|
92
91
|
clear_screen
|
@@ -96,8 +95,7 @@ class DoTime
|
|
96
95
|
clear_screen
|
97
96
|
select_list
|
98
97
|
when /c/i
|
99
|
-
|
100
|
-
position = get_position(char)
|
98
|
+
position = get_position(get_character.chr)
|
101
99
|
clear_screen
|
102
100
|
complete_todo(position)
|
103
101
|
when /r/i
|
@@ -109,7 +107,6 @@ class DoTime
|
|
109
107
|
when SPACE_KEY
|
110
108
|
clear_screen
|
111
109
|
stop_running_todo
|
112
|
-
puts "SPACE"
|
113
110
|
when /\d/
|
114
111
|
position = get_position(char)
|
115
112
|
clear_screen
|
@@ -130,9 +127,9 @@ class DoTime
|
|
130
127
|
else
|
131
128
|
end
|
132
129
|
unless second_digit
|
133
|
-
position = first_digit
|
130
|
+
position = first_digit.to_i
|
134
131
|
else
|
135
|
-
position = first_digit == 0 ? "0#{second_digit}" : "#{first_digit}#{second_digit}"
|
132
|
+
position = first_digit.to_i == 0 ? "0#{second_digit}" : "#{first_digit}#{second_digit}"
|
136
133
|
end
|
137
134
|
position
|
138
135
|
end
|
@@ -234,9 +231,9 @@ class DoTime
|
|
234
231
|
#Displays the text character of a key code
|
235
232
|
def key_to_char(key)
|
236
233
|
case key
|
237
|
-
when
|
234
|
+
when "\n","\r"
|
238
235
|
'ENTER'
|
239
|
-
when
|
236
|
+
when ' '
|
240
237
|
'SPACE'
|
241
238
|
else
|
242
239
|
key
|
@@ -540,10 +537,10 @@ class DoTime
|
|
540
537
|
second_key = nil
|
541
538
|
while /q/i !~ (key = get_character.chr)
|
542
539
|
if list.size > 9
|
543
|
-
second_key = get_character
|
544
|
-
second_key = [ENTER_KEY,SPACE_KEY].include?(second_key)
|
540
|
+
second_key = get_character.chr
|
541
|
+
second_key = nil if [ENTER_KEY,SPACE_KEY].include?(second_key)
|
545
542
|
end
|
546
|
-
result = second_key ? "#{key
|
543
|
+
result = second_key ? "#{key}#{second_key}".to_i : key.to_i
|
547
544
|
result = result - 1
|
548
545
|
return list[result], result
|
549
546
|
end
|