Method: ActiveMerchant::Billing::Compatibility.humanize

Defined in:
lib/active_merchant/billing/compatibility.rb

.humanize(lower_case_and_underscored_word) ⇒ Object



28
29
30
31
32
33
# File 'lib/active_merchant/billing/compatibility.rb', line 28

def self.humanize(lower_case_and_underscored_word)
  result = lower_case_and_underscored_word.to_s.dup
  result.gsub!(/_id$/, '')
  result.tr!('_', ' ')
  result.gsub(/([a-z\d]*)/i, &:downcase).gsub(/^\w/) { Regexp.last_match(0).upcase }
end