module AWS::Core::Inflection

@private

Public Class Methods

class_name(name) click to toggle source
# File lib/aws/core/inflection.rb, line 39
def class_name(name)
  name.sub(%r^(.)/) { |m| m.upcase }.
    gsub(%r[-_]([a-z])/) { |m| m[1,1].upcase }
end
ruby_name(aws_name) click to toggle source
# File lib/aws/core/inflection.rb, line 20
def ruby_name(aws_name)

  #aws_name.sub(/^.*:/, '').
  #  gsub(/[A-Z]+[a-z]+/){|str| "_#{str.downcase}_" }.
  #  gsub(/(^_|_$)/, '').
  #  gsub(/__/, '_').
  #  downcase

  return 'etag' if aws_name == 'ETag'

  aws_name.
    sub(%r^.*:/, '').                          # strip namespace
    gsub(%r([A-Z0-9]+)([A-Z][a-z])/, '\1_\2'). # split acronyms from words
    scan(%r[a-z]+|\d+|[A-Z0-9]+[a-z]*/).       # split remaining words
    join('_').downcase                        # join parts _ and downcase

end