So what if we replaced this:

910  title = hash.delete(:title)
911  title ||= hash[:name]
912  title ||= hash[key_attributes.first] if key_attributes.length == 1

With something that took an array of arrays of strings and symbols and
"reconstitutes" the title from the first one that matches:

  title = hash.delete(:title) 
  title ||= patterns.
    collect { |p| p.collect {|x| (x.is_a? Symbol) ? hash[x] : x}}.
    find { |pattern| pattern.all? { |x| x } }.
    join('')

And then the default (to get the same behaviour as before) would be:

    [
     [:name],
     [key_attributes.first] if key_attributes.length == 1
    ].compact

...but could (on a type-by-type basis) include things like:

      [:username,"@",:host,".",:domain]
 
....or
   
      [:protocol,":",:port]

...or whatever to build parsible titles as needed.

-- Markus


-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to