Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. class Title
  2.  
  3. def initialize(string)
  4. @string = string
  5. end
  6.  
  7. def fix
  8. string_array = @string.split(" ")
  9. string_array.map do |word|
  10. word.downcase!
  11. unless word.include?("of") || word.include?("and") || word.include?("the")
  12. word.capitalize!
  13. end
  14.  
  15. end
  16. string_array.join(" ")
  17. end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement