Method: Puppet::Type.title_patterns
- Defined in:
- lib/puppet/type.rb
.title_patterns ⇒ Array<Array<Regexp, Array<Array <Symbol, Proc>>>>?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Advanced: some logic requires this mapping to be done differently, using a different validation/pattern, breaking up the title into several parts assigning each to an individual attribute, or even use a composite identity where all namevars are seen as part of the unique identity (such computation is done by the #uniqueness method. These advanced options are rarely used (only one of the built in puppet types use this, and then only a small part of the available functionality), and the support for these advanced mappings is not implemented in a straight forward way. For these reasons, this method has been marked as private).
Returns a mapping from the title string to setting of attribute values. This default implementation provides a mapping of title to the one and only namevar present in the type’s definition.
430 431 432 433 434 435 436 437 438 |
# File 'lib/puppet/type.rb', line 430 def self.title_patterns case key_attributes.length when 0; [] when 1; [[/(.*)/m, [[key_attributes.first]]]] else raise Puppet::DevError, _("you must specify title patterns when there are two or more key attributes") end end |