Module: CfnDsl::Plurals

Defined in:
lib/cfndsl/plurals.rb

Overview

Plural names for lists of content objects

Class Method Summary collapse

Class Method Details

.pluralize(name) ⇒ Object



22
23
24
# File 'lib/cfndsl/plurals.rb', line 22

def pluralize(name)
  @plurals.fetch(name.to_s) { |key| "#{key}s" }
end

.singularize(name) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cfndsl/plurals.rb', line 26

def singularize(name)
  @singles.fetch(name.to_s) do |key|
    case key
    when /List$/
      key[0..-5]
    when /ies$/
      "#{key[0..-4]}y"
    when /s$/
      key[0..-2]
    else
      key
    end
  end
end