class String module_eval %{def last(n) self[-n, n] end} end p "Here's a string.".last(7) # => "string." String.module_eval %{def last(n) self[-n, n] end} p "Here's a string.".last(7) # => "string."