Class: Inspec::Input::NO_VALUE_SET
- Inherits:
-
Object
- Object
- Inspec::Input::NO_VALUE_SET
show all
- Defined in:
- lib/inspec/objects/input.rb
Overview
#
Class NO_VALUE_SET
#
This special class is used to represent the value when an input has not been assigned a value. This allows a user to explicitly assign nil to an input.
Instance Method Summary
collapse
Constructor Details
rubocop: disable Style/ClassAndModuleCamelCase
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/inspec/objects/input.rb', line 88
def initialize(name)
@name = name
Inspec::Log.warn(
"Input '#{@name}' does not have a value. "\
"Use --input-file to provide a value for '#{@name}' or specify a "\
"value with `attribute('#{@name}', value: 'somevalue', ...)`.",
) if Inspec::BaseCLI.inspec_cli_command == :exec
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*_) ⇒ Object
99
100
101
|
# File 'lib/inspec/objects/input.rb', line 99
def method_missing(*_)
self
end
|
Instance Method Details
#is_a?(klass) ⇒ Boolean
111
112
113
114
115
116
117
118
|
# File 'lib/inspec/objects/input.rb', line 111
def is_a?(klass)
if klass == Inspec::Attribute::DEFAULT_ATTRIBUTE
Inspec.deprecate(:rename_attributes_to_inputs, "Don't check for `is_a?(Inspec::Attribute::DEFAULT_ATTRIBUTE)`, check for `Inspec::Input::NO_VALUE_SET")
true else
super(klass)
end
end
|
#kind_of?(klass) ⇒ Boolean
120
121
122
123
124
125
126
127
|
# File 'lib/inspec/objects/input.rb', line 120
def kind_of?(klass)
if klass == Inspec::Attribute::DEFAULT_ATTRIBUTE
Inspec.deprecate(:rename_attributes_to_inputs, "Don't check for `kind_of?(Inspec::Attribute::DEFAULT_ATTRIBUTE)`, check for `Inspec::Input::NO_VALUE_SET")
true else
super(klass)
end
end
|
#respond_to_missing?(_, _) ⇒ Boolean
103
104
105
|
# File 'lib/inspec/objects/input.rb', line 103
def respond_to_missing?(_, _)
true
end
|
#to_s ⇒ Object
107
108
109
|
# File 'lib/inspec/objects/input.rb', line 107
def to_s
"Input '#{@name}' does not have a value. Skipping test."
end
|