From: Nigama Xx Date: 2007-12-13T05:10:37+09:00 Subject: .capitalize! not being recognized in home made sort method def sort some_array some_array.each do |n| # this code seems to be ignored n.capitalize! # end # recursive_sort some_array, [] end def recursive_sort unsorted_array, sorted_array unsorted_array.each do |n| if n < unsorted_array[n..((unsorted_array).length)] sorted_array << n end end end a = ["beaver", "Cat"] puts a.sort The program will sort fine, by the uppercase A-Z first, followed by lowercase a-z, but it seems to be ignoring the capitalization. Strangely, it *does* work in irb... a = ["aa", "bb", "cc"] a.each do |n| n.capitalize! end Returns: ["Aa", "Bb", "Cc"] So it works fine in irb, but not from within my method. I believe it's in the right place, as the intention is to capitalize! the array before the recursive_sort takes place. I've moved it around to see if it might work elsewhere in the two defined methods but got nada. Looked through Google and docs, but oddly everything says it *should* work. Any thoughts? -- Posted via http://www.ruby-forum.com/.