I have two lines of ruby code to strip URLs (string) of certain objects from their specific extension (string) and test and possibly reassign if they match a specific string (‘index’).
page_path = page_object.url_string.chomp(page_object.extension_string)
page_path = '' if page_path == 'index'
My actual variable names are different (shorter) of course, the ones above are just for better illustration.
Is it suitable and possible to get this done in one, elegant line of ruby code?
a possible solution