Class: Inspec::Value
- Inherits:
-
Object
- Object
- Inspec::Value
- Includes:
- RubyHelper
- Defined in:
- lib/inspec/objects/value.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#qualifier ⇒ Object
Returns the value of attribute qualifier.
-
#skip ⇒ Object
Returns the value of attribute skip.
-
#variable ⇒ Object
Returns the value of attribute variable.
Instance Method Summary collapse
-
#initialize(qualifiers = []) ⇒ Value
constructor
A new instance of Value.
- #name_variable(cache = []) ⇒ Object
- #to_ruby ⇒ Object
Methods included from RubyHelper
Constructor Details
#initialize(qualifiers = []) ⇒ Value
Returns a new instance of Value.
14 15 16 17 18 19 |
# File 'lib/inspec/objects/value.rb', line 14 def initialize(qualifiers = []) @qualifier = qualifiers @variable = nil Inspec.deprecate(:object_classes, "The Inspec::Value class is deprecated. Use the Inspec::Object::Value class from the inspec-objects Ruby library.") end |
Instance Attribute Details
#qualifier ⇒ Object
Returns the value of attribute qualifier.
10 11 12 |
# File 'lib/inspec/objects/value.rb', line 10 def qualifier @qualifier end |
#skip ⇒ Object
Returns the value of attribute skip.
11 12 13 |
# File 'lib/inspec/objects/value.rb', line 11 def skip @skip end |
#variable ⇒ Object
Returns the value of attribute variable.
12 13 14 |
# File 'lib/inspec/objects/value.rb', line 12 def variable @variable end |
Instance Method Details
#name_variable(cache = []) ⇒ Object
26 27 28 29 30 |
# File 'lib/inspec/objects/value.rb', line 26 def name_variable(cache = []) @variable = Array("a".."z").find { |x| !cache.include?(x) } cache.push(@variable) @variable end |
#to_ruby ⇒ Object
21 22 23 24 |
# File 'lib/inspec/objects/value.rb', line 21 def to_ruby res = @variable.nil? ? "" : "#{@variable} = " res + @qualifier.map { |x| ruby_qualifier(x) }.join(".") end |