Module:
ActiveSupport::Inflector
ActiveSupport::Inflector::Inflections
如果你有裝 rails 那裡面就包含了ActiveSuppt,如果沒有的話可以透過以下指令來安裝:
C:\> gem install rails
或是只裝Active Support
C:\> gem install activesupport
Sample Code:
require 'active_support/inflector' require 'active_support/inflections' puts "box".pluralize # => "boxes" puts "child".pluralize # => "children" puts "pets".singularize # => "pets" puts "women".singularize # => "woman"
It's so cool!!