malysz87-highline 1.5.10 → 1.5.11
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/highline.rb +9 -3
- data/test/tc_highline.rb +1 -1
- metadata +2 -2
data/lib/highline.rb
CHANGED
@@ -29,12 +29,16 @@ require "abbrev"
|
|
29
29
|
#
|
30
30
|
class HighLine
|
31
31
|
# The version of the installed library.
|
32
|
-
VERSION = "1.5.
|
32
|
+
VERSION = "1.5.9".freeze
|
33
33
|
|
34
34
|
# An internal HighLine error. User code does not need to trap this.
|
35
35
|
class QuestionError < StandardError
|
36
36
|
# do nothing, just creating a unique error type
|
37
37
|
end
|
38
|
+
|
39
|
+
class InvalidAnswerError < StandardError
|
40
|
+
# do nothing, just creating a unique error type
|
41
|
+
end
|
38
42
|
|
39
43
|
# The setting used to disable color output.
|
40
44
|
@@use_color = true
|
@@ -220,8 +224,7 @@ class HighLine
|
|
220
224
|
begin
|
221
225
|
@answer = @question.answer_or_default(get_response)
|
222
226
|
unless @question.valid_answer?(@answer)
|
223
|
-
|
224
|
-
raise QuestionError
|
227
|
+
raise InvalidAnswerError
|
225
228
|
end
|
226
229
|
|
227
230
|
@answer = @question.convert(@answer)
|
@@ -252,6 +255,9 @@ class HighLine
|
|
252
255
|
end
|
253
256
|
rescue QuestionError
|
254
257
|
retry
|
258
|
+
rescue InvalidAnswerError
|
259
|
+
actions[:not_valid].call(:not_valid, @answer, actions.default)
|
260
|
+
retry
|
255
261
|
rescue ArgumentError
|
256
262
|
actions[:invalid_type].call(:invalid_type, @answer, actions.default)
|
257
263
|
retry
|
data/test/tc_highline.rb
CHANGED
@@ -818,7 +818,7 @@ class TestHighLine < Test::Unit::TestCase
|
|
818
818
|
assert_not_nil(HighLine::VERSION)
|
819
819
|
assert_instance_of(String, HighLine::VERSION)
|
820
820
|
assert(HighLine::VERSION.frozen?)
|
821
|
-
assert_match(/\
|
821
|
+
assert_match(/\d\.\d\.\d/, HighLine::VERSION)
|
822
822
|
end
|
823
823
|
|
824
824
|
def test_ask_with_mane_answers
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: malysz87-highline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Edward Gray II
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-02-
|
12
|
+
date: 2009-02-25 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|