tty-prompt 0.21.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,49 +0,0 @@
1
- module TTY
2
- class Prompt
3
- class Messages
4
-
5
- def setup_messages
6
- @messages = {
7
- range?: 'Value %{value} must be within the range %{in}',
8
- valid?: 'Your answer is invalid (must match %{valid})',
9
- required?: 'Value must be provided'
10
- }
11
- end
12
-
13
- def initialize
14
- setup_messages
15
- end
16
-
17
- # Stores all the error messages displayed to user
18
- # The currently supported messages are:
19
- # * :range?
20
- # * :required?
21
- # * :valid?
22
- attr_reader :messages
23
-
24
- def get(key)
25
-
26
- end
27
-
28
- # Retrieve message based on the key
29
- #
30
- # @param [Symbol] name
31
- # the name of message key
32
- #
33
- # @param [Hash] tokens
34
- # the tokens to evaluate
35
- #
36
- # @return [Array[String]]
37
- #
38
- # @api private
39
- def message_for(name, tokens = nil)
40
- template = @messages[name]
41
- if !template.match(/\%\{/).nil?
42
- [template % tokens]
43
- else
44
- [template]
45
- end
46
- end
47
- end
48
- end
49
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'prompt'
4
-
5
- module TTY
6
- # Used for initializing test cases
7
- class TestPrompt < Prompt
8
- def initialize(options = {})
9
- @input = StringIO.new
10
- @output = StringIO.new
11
- options.merge!({
12
- input: @input,
13
- output: @output,
14
- env: { "TTY_TEST" => true },
15
- enable_color: options.fetch(:enable_color) { true }
16
- })
17
- super(options)
18
- end
19
- end # TestPrompt
20
- end # TTY