Method: Puppet::Type#name_var

Defined in:
lib/puppet/type.rb

#name_varSymbol, Boolean

Returns the name of the namevar if there is only one or false otherwise.

Returns:

  • (Symbol, Boolean)

    Returns the name of the namevar if there is only one or false otherwise.



638
639
640
641
642
643
# File 'lib/puppet/type.rb', line 638

def name_var
  return @name_var_cache unless @name_var_cache.nil?

  key_attributes = self.class.key_attributes
  @name_var_cache = (key_attributes.length == 1) && key_attributes.first
end