Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/dm-is-taggable/tag_list.rb

Overview

Backporting the ends_with? method from Rails’ ActiveSupport

Instance Method Summary collapse

Instance Method Details

#ends_with?(suffix) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
# File 'lib/dm-is-taggable/tag_list.rb', line 3

def ends_with?(suffix)
  suffix = suffix.to_s
  self[-suffix.length, suffix.length] == suffix     
end