Sha256: 000f06809bd7edcd306d85a35359fb5ef7006843e3f19603c70b55acb96c7d23
Contents?: true
Size: 646 Bytes
Versions: 44
Compression:
Stored size: 646 Bytes
Contents
require "pact_broker/string_refinements" module PactBroker module Pacticipants module GenerateDisplayName using PactBroker::StringRefinements def self.call(name) return nil if name.nil? name .to_s .gsub(/([A-Z])([A-Z])([a-z])/,'\1 \2\3') .gsub(/([a-z\d])([A-Z])(\S)/,'\1 \2\3') .gsub(/(\S)([\-_\s\.])(\S)/, '\1 \3') .gsub(/\s+/, " ") .strip .split(" ") .collect{ |word| word.camelcase(true) } .join(" ") end def generate_display_name(name) GenerateDisplayName.call(name) end end end end
Version data entries
44 entries across 44 versions & 1 rubygems