Sha256: 96e86f3019847b7de648836bf6cb8ebdf98691f411d243042d734cf253a786e6
Contents?: true
Size: 907 Bytes
Versions: 21
Compression:
Stored size: 907 Bytes
Contents
module CfnDsl # Plural names for lists of content objects module Plurals @plurals = { 'Metadata' => 'Metadata', 'Property' => 'Properties', 'Policy' => 'Policies', 'PolicyDocument' => 'PolicyDocument', 'AssumeRolePolicyDocument' => 'AssumeRolePolicyDocument', 'SecurityGroupIngress' => 'SecurityGroupIngress', 'SecurityGroupEgress' => 'SecurityGroupEgress', 'DBSecurityGroupIngress' => 'DBSecurityGroupIngress', 'UpdatePolicy' => 'UpdatePolicy', 'CreationPolicy' => 'CreationPolicy' } @singles = {} @plurals.each_pair { |key, val| @singles[val] = key } def self.pluralize(name) name = name.to_s return @plurals[name] if @plurals.key?(name) "#{name}s" end def self.singularize(name) name = name.to_s return @singles[name] if @singles.key?(name) name[0..-2] end end end
Version data entries
21 entries across 21 versions & 1 rubygems