highline 2.0.0.pre.develop.12 → 2.0.0.pre.develop.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20085d360090ca1af2b16c4ec579647ec88a79f2
4
- data.tar.gz: 5b41382a10fef5b7ff836c69ed4eff2dbe50f65c
3
+ metadata.gz: 15f4a2a4093aa40f67585d304e451b7015ef098d
4
+ data.tar.gz: 3a192714c98631c7ec8263993fa3effa8f1c36b9
5
5
  SHA512:
6
- metadata.gz: 9c12e2b43c53506dcb614024f726310fe0282db48c60ee0ce6bd01c15ee3c05592929310d939045b479c6ee12c8161a186b627eddef33c83477f9e0d5b06bda1
7
- data.tar.gz: 81a74acd56063ae2262b4da7156938cb20434e469e19c2636bcb6943e6e93fa6c36dfddd8d7095cc03dcddea3ade28d104d30880cd858c5a64e566a2a1a5995e
6
+ metadata.gz: 6544dfa49255c98a453fcde92a5da742bc22bf3f02553f648f8c7568e04a67a524fbfe6cf325ed009f3a00fbcbb30777707db243f87bc3cfe2a946ddb71b04a1
7
+ data.tar.gz: d5d06ecbb06d9d062a5b344cac7de0e547b0ef3122e895131d5f56ab7beb4f3a637e58b5af3755c6ad7f836c1e10ec97e9019f73011d26237158eb50f9877627
@@ -2,7 +2,10 @@
2
2
 
3
3
  Below is a complete listing of changes for each revision of HighLine.
4
4
 
5
- ### Unreleased
5
+ ### 2.0.0-develop.13 / 2017-11-05
6
+ * PR #219 - Make possible to use a callable as response (@abinoam)
7
+
8
+ ### 2.0.0-develop.12 / 2017-10-19
6
9
  * PR #218 - Ease transition from 1.7.x to 2.0.x (@abinoam)
7
10
  * Copy use_color from HighLine.default_instance
8
11
  * Expose IOConsoleCompatible
@@ -479,15 +479,6 @@ class HighLine
479
479
 
480
480
  private
481
481
 
482
- #
483
- # A helper method for sending the output stream and error and repeat
484
- # of the question.
485
- #
486
- def explain_error(error, question)
487
- say(question.final_responses[error]) if error
488
- say(question.ask_on_error_msg)
489
- end
490
-
491
482
  # Adds a layer of scope (new_scope) to ask a question inside a
492
483
  # question, without destroying instance data
493
484
  def confirm(question)
@@ -289,6 +289,15 @@ class HighLine
289
289
  @internal_responses.merge(@user_responses)
290
290
  end
291
291
 
292
+ def final_response(error)
293
+ response = final_responses[error]
294
+ if response.respond_to?(:call)
295
+ response.call(answer)
296
+ else
297
+ response
298
+ end
299
+ end
300
+
292
301
  #
293
302
  # Returns the provided _answer_string_ after changing character case by
294
303
  # the rules of this Question. Valid settings for whitespace are:
@@ -114,8 +114,8 @@ class HighLine
114
114
  private
115
115
 
116
116
  ## Delegate to Highline
117
- def explain_error(error)
118
- @highline.say(question.final_responses[error]) if error
117
+ def explain_error(explanation_key) # eg: :not_valid, :not_in_range
118
+ @highline.say(question.final_response(explanation_key))
119
119
  @highline.say(question.ask_on_error_msg)
120
120
  end
121
121
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  class HighLine
4
4
  # The version of the installed library.
5
- VERSION = "2.0.0-develop.12".freeze
5
+ VERSION = "2.0.0-develop.13".freeze
6
6
  end
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.12
4
+ version: 2.0.0.pre.develop.13
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: 2017-10-19 00:00:00.000000000 Z
11
+ date: 2017-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  version: 1.3.1
146
146
  requirements: []
147
147
  rubyforge_project:
148
- rubygems_version: 2.6.13
148
+ rubygems_version: 2.6.14
149
149
  signing_key:
150
150
  specification_version: 4
151
151
  summary: HighLine is a high-level command-line IO library.