Class: Gitlab::Ci::Config::Interpolation::Inputs::BooleanInput

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

Constant Summary

Constants inherited from BaseInput

Gitlab::Ci::Config::Interpolation::Inputs::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
# File 'lib/gitlab/ci/config/interpolation/inputs/boolean_input.rb', line 9

def self.matches?(spec)
  spec.is_a?(Hash) && spec[:type] == type_name
end

.type_nameObject



13
14
15
# File 'lib/gitlab/ci/config/interpolation/inputs/boolean_input.rb', line 13

def self.type_name
  'boolean'
end

Instance Method Details

#valid_value?(value) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/gitlab/ci/config/interpolation/inputs/boolean_input.rb', line 17

def valid_value?(value)
  [true, false].include?(value)
end