Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci/config/interpolation/inputs/string_input.rb')
-rw-r--r--lib/gitlab/ci/config/interpolation/inputs/string_input.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/gitlab/ci/config/interpolation/inputs/string_input.rb b/lib/gitlab/ci/config/interpolation/inputs/string_input.rb
new file mode 100644
index 00000000000..39870582d0c
--- /dev/null
+++ b/lib/gitlab/ci/config/interpolation/inputs/string_input.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Ci
+ class Config
+ module Interpolation
+ class Inputs
+ class StringInput < BaseInput
+ def self.matches?(spec)
+ # The input spec can be `nil` when using a minimal specification
+ # and also when `type` is not specified.
+ #
+ # ```yaml
+ # spec:
+ # inputs:
+ # foo:
+ # ```
+ spec.nil? || (spec.is_a?(Hash) && [nil, type_name].include?(spec[:type]))
+ end
+
+ def self.type_name
+ 'string'
+ end
+
+ def valid_value?(value)
+ value.nil? || value.is_a?(String)
+ end
+ end
+ end
+ end
+ end
+ end
+end