Skip to content

Add Ruby 2.6 fixing issues #233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ rvm:
- 2.3
- 2.4.2
- 2.5
- 2.6
- ruby-head
- jruby
branches:
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions lib/coderay/tokens.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions test/unit/filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def test_filtering_text_tokens
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

Expand All @@ -32,6 +33,7 @@ def test_filtering_block_tokens
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

Expand Down