Skip to content

Commit

Permalink
fix: use rb_warn over rb_category_warn for Ruby 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous committed May 16, 2024
1 parent 9ada77e commit 0fd7b5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
10 changes: 2 additions & 8 deletions ext/jaro_winkler/jaro_winkler.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ VALUE distance(int argc, VALUE *argv, VALUE self,
}

VALUE rb_jaro_distance(int argc, VALUE *argv, VALUE self) {
rb_category_warn(
RB_WARN_CATEGORY_DEPRECATED,
"JaroWinkler.jaro_distance is deprecated. Use JaroWinkler.jaro_similarity instead."
);
rb_warn("JaroWinkler.jaro_distance is deprecated. Use JaroWinkler.jaro_similarity instead.");
return rb_jaro_similarity(argc, argv, self);
}

Expand All @@ -87,10 +84,7 @@ VALUE rb_jaro_similarity(int argc, VALUE *argv, VALUE self) {
}

VALUE rb_jaro_winkler_distance(int argc, VALUE *argv, VALUE self) {
rb_category_warn(
RB_WARN_CATEGORY_DEPRECATED,
"JaroWinkler.distance is deprecated. Use JaroWinkler.similarity instead."
);
rb_warn("JaroWinkler.distance is deprecated. Use JaroWinkler.similarity instead.");
return rb_jaro_winkler_similarity(argc, argv, self);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/jaro_winkler/jaro_winkler_pure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class InvalidWeightError < Error; end

class << self
def distance(str1, str2, options = {})
warn("JaroWinkler.distance is deprecated. Use JaroWinkler.similarity instead.", category: :deprecated)
warn("JaroWinkler.distance is deprecated. Use JaroWinkler.similarity instead.")
similarity(str1, str2, options)
end

Expand All @@ -24,7 +24,7 @@ def similarity(str1, str2, options = {})
end

def jaro_distance(str1, str2, options = {})
warn("JaroWinkler.jaro_distance is deprecated. Use JaroWinkler.jaro_similarity instead.", category: :deprecated)
warn("JaroWinkler.jaro_distance is deprecated. Use JaroWinkler.jaro_similarity instead.")
jaro_similarity(str1, str2, options)
end

Expand Down

0 comments on commit 0fd7b5d

Please sign in to comment.