ruby how to remove last element from hash code example Example: ruby remove last element of string 'abc1234'.chomp(4) # => 'abc123' 'toto'.chomp('to') # => 'to'