File attached.

I need some help with a simple program to capitalize the first letter of
each word in a sentence.

I'm not sure if I should be using class Array, but I dont think that's
the problem.

Here's the code:

class Array
  def title_format (title)
    puts title.split(" ").each{|element| print
element.capitalize!}.join(" ")
    return title_format
  end
end

puts "Please type the sentence you want to have put in \"Title Format\""

title = gets.chomp

title.title_format

Help would be greatly appreciated. This is the error i get:

sentence_caps.rb:18: undefined method `title_format' for "please help me
with my program":String (NoMethodError)

Thanks

Attachments:
http://www.ruby-forum.com/attachment/6641/sentence_caps.rb


-- 
Posted via http://www.ruby-forum.com/.