aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/inflector.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-03-08 02:56:25 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-03-08 02:56:25 +0000
commitcd989472a5248aae4f827c35347bdb871de1822a (patch)
tree13cad5fa4cd877788747930fe6076fcd01085a0f /activesupport/lib/active_support/inflector.rb
parent24fca9d92ea9bef676f74259996c4039e014dfe2 (diff)
downloadrails-cd989472a5248aae4f827c35347bdb871de1822a.tar.gz
rails-cd989472a5248aae4f827c35347bdb871de1822a.tar.bz2
rails-cd989472a5248aae4f827c35347bdb871de1822a.zip
Added Hash#to_xml and Array#to_xml that makes it much easier to produce XML from basic structures [DHH] Moved Jim Weirich's wonderful Builder from Action Pack to Active Support (it's simply too useful to be stuck in AP) [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3812 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/inflector.rb')
-rw-r--r--activesupport/lib/active_support/inflector.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/inflector.rb b/activesupport/lib/active_support/inflector.rb
index f91a73c7f3..bbc5e10579 100644
--- a/activesupport/lib/active_support/inflector.rb
+++ b/activesupport/lib/active_support/inflector.rb
@@ -120,6 +120,10 @@ module Inflector
def underscore(camel_cased_word)
camel_cased_word.to_s.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase
end
+
+ def dasherize(underscored_word)
+ underscored_word.gsub(/_/, '-')
+ end
def humanize(lower_case_and_underscored_word)
lower_case_and_underscored_word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize