Method: Puppet::Pops::Types::TypeFormatter#capitalize_segments
- Defined in:
- lib/puppet/pops/types/type_formatter.rb
#capitalize_segments(qualified_name) ⇒ String
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.
Capitalizes each segment in a name separated with the NAME_SEPARATOR conditionally. The name will not be subject to capitalization if it already starts with a capital letter. This to avoid that existing camel casing is lost.
644 645 646 647 648 649 650 651 652 653 654 655 656 |
# File 'lib/puppet/pops/types/type_formatter.rb', line 644 def capitalize_segments(qualified_name) if !qualified_name.is_a?(String) || qualified_name =~ STARTS_WITH_ASCII_CAPITAL qualified_name else segments = qualified_name.split(NAME_SEGMENT_SEPARATOR) if segments.size == 1 qualified_name.capitalize else segments.each(&:capitalize!) segments.join(NAME_SEGMENT_SEPARATOR) end end end |