Sha256: 6831a16b89681ca4fb60d6b2d7ea05d2eac745091bf11612064d2330f1dc2ffe
Contents?: true
Size: 655 Bytes
Versions: 47
Compression:
Stored size: 655 Bytes
Contents
require 'pact_broker/client/string_refinements' module PactBroker module Client module GenerateDisplayName using PactBroker::Client::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
47 entries across 47 versions & 1 rubygems