Module: Typekit::Helper
- Defined in:
- lib/typekit/helper.rb
Class Method Summary collapse
Class Method Details
.pluralize(name) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/typekit/helper.rb', line 3 def self.pluralize(name) case name when /^.*s$/ name when /^(?<root>.*)y$/ "#{ Regexp.last_match(:root) }ies" else "#{ name }s" end end |
.singularize(name) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/typekit/helper.rb', line 14 def self.singularize(name) case name when /^(?<root>.*)ies$/ "#{ Regexp.last_match(:root) }y" when /^(?<root>.*)s$/ Regexp.last_match(:root) else name end end |