Sha256: ea79447e7c0d50b5f70418606bf23ae40abf6832a6a478266efb86bd4ddd513b

Contents?: true

Size: 588 Bytes

Versions: 6

Compression:

Stored size: 588 Bytes

Contents

# encoding:utf-8

module Inspec
  class Value
    include ::Inspec::RubyHelper

    attr_accessor :qualifier
    attr_accessor :skip
    attr_accessor :variable

    def initialize(qualifiers = [])
      @qualifier = qualifiers
      @variable = nil
    end

    def to_ruby
      res = @variable.nil? ? '' : "#{@variable} = "
      res + @qualifier.map { |x| ruby_qualifier(x) }.join('.')
    end

    def name_variable(cache = [])
      @variable = Array('a'..'z').find { |x| !cache.include?(x) }
      cache.push(@variable)
      @variable
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
inspec-2.1.81 lib/inspec/objects/value.rb
inspec-2.1.21 lib/inspec/objects/value.rb
inspec-2.1.10 lib/inspec/objects/value.rb
inspec-2.0.32 lib/inspec/objects/value.rb
inspec-2.0.17 lib/inspec/objects/value.rb
inspec-1.51.15 lib/inspec/objects/value.rb