Module: CfnDsl::Plurals

Defined in:
lib/cfndsl/Plurals.rb

Constant Summary collapse

@@plurals =

Plural names for lists of content objects

{ 
  "Metadata" => "Metadata", 
  "Property" => "Properties",
  "Policy" => "Policies",
  "PolicyDocument" => "PolicyDocument",
  "AssumeRolePolicyDocument" => "AssumeRolePolicyDocument",
  "SecurityGroupIngress" => "SecurityGroupIngress",
  "SecurityGroupEgress" => "SecurityGroupEgress",
  "DBSecurityGroupIngress" => "DBSecurityGroupIngress",
  "UpdatePolicy" => "UpdatePolicy",
  "CreationPolicy" => "CreationPolicy"
}
@@singles =
{}

Class Method Summary collapse

Class Method Details

.pluralize(name) ⇒ Object



23
24
25
26
27
# File 'lib/cfndsl/Plurals.rb', line 23

def self.pluralize(name)
  name = name.to_s
  return @@plurals[name] if( @@plurals.has_key? name )
  return "#{name}s"
end

.singularize(name) ⇒ Object



29
30
31
32
33
# File 'lib/cfndsl/Plurals.rb', line 29

def self.singularize(name)
  name = name.to_s
  return @@singles[name] if( @@singles.has_key? name )
  return name[0..-2]
end