Module: ActiveSupport::CoreExtensions::String::Inflections
- Included in:
- String
- Defined in:
- lib/action_controller/support/core_ext/string/inflections.rb
Overview
Makes it possible to do “posts”.singularize that returns “post” and “MegaCoolClass”.underscore that returns “mega_cool_class”.
Instance Method Summary collapse
- #camelize ⇒ Object
- #classify ⇒ Object
- #demodulize ⇒ Object
- #foreign_key(separate_class_name_and_id_with_underscore = true) ⇒ Object
- #humanize ⇒ Object
- #pluralize ⇒ Object
- #singularize ⇒ Object
- #tableize ⇒ Object
- #underscore ⇒ Object
Instance Method Details
#camelize ⇒ Object
15 16 17 |
# File 'lib/action_controller/support/core_ext/string/inflections.rb', line 15 def camelize Inflector.camelize(self) end |
#classify ⇒ Object
31 32 33 |
# File 'lib/action_controller/support/core_ext/string/inflections.rb', line 31 def classify Inflector.classify(self) end |
#demodulize ⇒ Object
23 24 25 |
# File 'lib/action_controller/support/core_ext/string/inflections.rb', line 23 def demodulize Inflector.demodulize(self) end |
#foreign_key(separate_class_name_and_id_with_underscore = true) ⇒ Object
39 40 41 |
# File 'lib/action_controller/support/core_ext/string/inflections.rb', line 39 def foreign_key(separate_class_name_and_id_with_underscore = true) Inflector.foreign_key(self, separate_class_name_and_id_with_underscore) end |
#humanize ⇒ Object
35 36 37 |
# File 'lib/action_controller/support/core_ext/string/inflections.rb', line 35 def humanize Inflector.humanize(self) end |
#pluralize ⇒ Object
7 8 9 |
# File 'lib/action_controller/support/core_ext/string/inflections.rb', line 7 def pluralize Inflector.pluralize(self) end |
#singularize ⇒ Object
11 12 13 |
# File 'lib/action_controller/support/core_ext/string/inflections.rb', line 11 def singularize Inflector.singularize(self) end |
#tableize ⇒ Object
27 28 29 |
# File 'lib/action_controller/support/core_ext/string/inflections.rb', line 27 def tableize Inflector.tableize(self) end |
#underscore ⇒ Object
19 20 21 |
# File 'lib/action_controller/support/core_ext/string/inflections.rb', line 19 def underscore Inflector.underscore(self) end |