Module: Glia::Errors::Naming

Defined in:
lib/glia/errors/naming.rb

Overview

Utilities for variable and resouce names

Constant Summary collapse

ABBREVIATIONS =
%w[id uuid saml sip sms mms].freeze
PLURAL_ABBREVIATIONS =
%w[ids uuids].freeze

Class Method Summary collapse

Class Method Details

.humanize(value) ⇒ Object

Converts from camel_case to more human readable value first_name => “First name” site_id => “Site ID”



10
11
12
13
14
# File 'lib/glia/errors/naming.rb', line 10

def self.humanize(value)
  result = value.to_s.split('_').map { |word| upcase_if_abbreviation(word) }.join(' ')

  upcase_first(result)
end