method
rstrip

rstrip()
public
Returns a copy of str with trailing whitespace removed. See also String#lstrip and String#strip.
Refer to strip for the definition of whitespace.
" hello ".rstrip #=> " hello" "hello".rstrip #=> "hello"