| Module | ActiveSupport::CoreExtensions::String::StartsEndsWith |
| In: |
vendor/rails/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb
|
Additional string tests.
# File vendor/rails/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb, line 6
6: def self.included(base)
7: base.class_eval do
8: alias_method :start_with?, :starts_with?
9: alias_method :end_with?, :ends_with?
10: end
11: end
Does the string end with the specified suffix?
# File vendor/rails/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb, line 20
20: def ends_with?(suffix)
21: suffix = suffix.to_s
22: self[-suffix.length, suffix.length] == suffix
23: end