Removes Symbol#start_with? and Symbol#end_with? since they are defined in Ruby 2.7

This commit just removes the implementation of those methods and leaves the aliases for `starts_with` and `ends_with?`.
This commit is contained in:
André Luis Leal Cardoso Junior 2021-02-07 21:45:48 -03:00
parent a33334ada1
commit ce01aafb82
2 changed files with 0 additions and 23 deletions

@ -1,14 +1,6 @@
# frozen_string_literal: true
class Symbol
def start_with?(*prefixes)
to_s.start_with?(*prefixes)
end unless method_defined?(:start_with?)
def end_with?(*suffixes)
to_s.end_with?(*suffixes)
end unless method_defined?(:end_with?)
alias :starts_with? :start_with?
alias :ends_with? :end_with?
end

@ -4,21 +4,6 @@
require "active_support/core_ext/symbol"
class SymbolStartsEndsWithTest < ActiveSupport::TestCase
def test_start_end_with
s = :hello
assert s.start_with?("h")
assert s.start_with?("hel")
assert_not s.start_with?("el")
assert s.start_with?("he", "lo")
assert_not s.start_with?("el", "lo")
assert s.end_with?("o")
assert s.end_with?("lo")
assert_not s.end_with?("el")
assert s.end_with?("he", "lo")
assert_not s.end_with?("he", "ll")
end
def test_starts_ends_with_alias
s = :hello
assert s.starts_with?("h")