Class: Gitlab::Ci::Config::Interpolation::Inputs::StringInput

Inherits:
BaseInput
  • Object
show all
Defined in:
lib/gitlab/ci/config/interpolation/inputs/string_input.rb

Constant Summary

Constants inherited from BaseInput

BaseInput::ArgumentNotValidError

Instance Attribute Summary

Attributes inherited from BaseInput

#errors, #name, #spec, #value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseInput

#initialize, #to_hash, #valid?

Constructor Details

This class inherits a constructor from Gitlab::Ci::Config::Interpolation::Inputs::BaseInput

Class Method Details

.matches?(spec) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
17
18
19
# File 'lib/gitlab/ci/config/interpolation/inputs/string_input.rb', line 9

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

.type_nameObject



21
22
23
# File 'lib/gitlab/ci/config/interpolation/inputs/string_input.rb', line 21

def self.type_name
  'string'
end

Instance Method Details

#valid_value?(value) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/gitlab/ci/config/interpolation/inputs/string_input.rb', line 25

def valid_value?(value)
  value.nil? || value.is_a?(String)
end