Newer
Older
2018-fumichan-thesis / sinatra-practice / form-sample / vendor / bundle / ruby / 2.5.0 / gems / backports-3.11.4 / lib / backports / 1.8.7 / string / end_with.rb
unless String.method_defined? :end_with?
  class String
    def end_with?(*suffixes)
      suffixes.any? do |suffix|
        if suffix.respond_to? :to_str
          suffix = suffix.to_str
          self[-suffix.length, suffix.length] == suffix
        end
      end
    end
  end
end