exercises/handling-get-requests/app.rb
##
# Converts an author string into a comparable offer string. Supports URI
# Escaped author names.
#
# Examples:
#  comparable_author("Zee Spencer") # => "zee-spencer"
#  comparable_author("Ada Lovelace") # => "ada-lovelace"
#  comparable_author("E.%20W.%20Dijkstra") # => "e-w-dijkstra"
Converts an author string into a comparable offer string. Supports URI
Escaped author names.


Converts an author string into a comparable offer string . Supports URI Escaped author names .
def comparable_author(author)
  decoded_author = URI.unescape(author)
  case_insensitive_author = decoded_author.downcase
  author_with_spaces_replaced = case_insensitive_author.gsub(" ", "-")
  author_with_non_alpha_chars_stripped = author_with_spaces_replaced.gsub(/[^a-z-]/, "")
  author_with_non_alpha_chars_stripped
end
def comparable_author ( author ) decoded_author = URI . unescape ( author ) case_insensitive_author = decoded_author . downcase author_with_spaces_replaced = case_insensitive_author . gsub ( " " , "-" ) author_with_non_alpha_chars_stripped = author_with_spaces_replaced . gsub ( / [^a-z-] / , "" ) author_with_non_alpha_chars_stripped end
Converts an author string into a comparable offer string.
Converts an author string into a comparable offer string .
author