diff options
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | lib/coderay/tokens.rb | 3 | ||||
-rw-r--r-- | test/unit/filter.rb | 2 |
4 files changed, 7 insertions, 2 deletions
diff --git a/.travis.yml b/.travis.yml index 49829cd..c1fa23a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ rvm: - 2.3 - 2.4.2 - 2.5 + - 2.6 - ruby-head - jruby branches: @@ -20,7 +21,6 @@ before_script: - if (ruby -e "exit RUBY_VERSION.to_f >= 2.3"); then export RUBYOPT="--enable-frozen-string-literal"; fi; echo $RUBYOPT matrix: allow_failures: - - rvm: 2.5 - rvm: ruby-head - rvm: jruby script: "rake test" # test:scanners" @@ -14,5 +14,5 @@ group :development do gem 'shoulda-context', RUBY_VERSION < '1.9' ? '= 1.2.1' : '>= 1.2.1' gem 'test-unit', RUBY_VERSION < '1.9' ? '~> 2.0' : '>= 3.0' gem 'json', '>= 1.8' if RUBY_VERSION < '1.9' - gem 'rdoc', RUBY_VERSION < '1.9' ? '~> 4.2.2' : '>= 4.2.2' + gem 'rdoc', Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3') ? '~> 4.2.2' : Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.2') ? '< 6' : '>= 6' end diff --git a/lib/coderay/tokens.rb b/lib/coderay/tokens.rb index e7bffce..b5f78e7 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 diff --git a/test/unit/filter.rb b/test/unit/filter.rb index 25dff77..6e939f3 100644 --- a/test/unit/filter.rb +++ b/test/unit/filter.rb @@ -18,6 +18,7 @@ class FilterTest < Test::Unit::TestCase tokens.text_token i.to_s, :index end assert_equal tokens, CodeRay::Encoders::Filter.new.encode_tokens(tokens) + assert_equal CodeRay::Tokens, tokens.filter.class assert_equal tokens, tokens.filter end @@ -32,6 +33,7 @@ class FilterTest < Test::Unit::TestCase tokens.end_line :index end assert_equal tokens, CodeRay::Encoders::Filter.new.encode_tokens(tokens) + assert_equal CodeRay::Tokens, tokens.filter.class assert_equal tokens, tokens.filter end |