Remove extended Tokens#filter for Ruby 2.6 compatibility.

This commit is contained in:
Jun Aruga 2019-02-14 17:56:01 +01:00
parent 0812a29d56
commit 9dc3962871
2 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,14 @@
diff --git a/lib/coderay/tokens.rb b/lib/coderay/tokens.rb
index e7bffce2..b5f78e71 100644
--- a/lib/coderay/tokens.rb
+++ b/lib/coderay/tokens.rb
@@ -39,6 +39,9 @@ module CodeRay
# You can serialize it to a JSON string and store it in a database, pass it
# around to encode it more than once, send it to other algorithms...
class Tokens < Array
+ # Remove Array#filter that is a new alias for Array#select on Ruby 2.6,
+ # for method_missing called with filter method.
+ undef_method :filter if instance_methods.include?(:filter)
# The Scanner instance that created the tokens.
attr_accessor :scanner

View File

@ -2,7 +2,7 @@
Name: rubygem-%{gem_name}
Version: 1.1.2
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Fast syntax highlighting for selected languages
License: MIT
URL: http://coderay.rubychan.de
@ -10,6 +10,9 @@ Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
# git clone https://github.com/rubychan/coderay.git && cd coderay
# git checkout v1.1.2 && tar czvf coderay-1.1.2-tests.tgz test/
Source1: %{gem_name}-%{version}-tests.tgz
# Remove extended Tokens#filter for Ruby 2.6 compatibility.
# https://github.com/rubychan/coderay/pull/233
Patch0: rubygem-coderay-1.1.2-remove-Array-filter-for-ruby-2.6.patch
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby >= 1.8.6
@ -32,6 +35,8 @@ Documentation for %{name}.
%prep
%setup -q -n %{gem_name}-%{version}
%patch0 -p1
%build
gem build ../%{gem_name}-%{version}.gemspec
@ -73,6 +78,9 @@ popd
%doc %{gem_instdir}/README_INDEX.rdoc
%changelog
* Thu Feb 14 2019 Jun Aruga <jaruga@redhat.com> - 1.1.2-5
- Remove extended Tokens#filter for Ruby 2.6 compatibility.
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild