Commit a45a137a by Daniel Mendler Committed by GitHub

Merge pull request #87 from aliismayilov/frozen-string-literals

Ensure that frozen string literals used throughout the code
parents 01f92d86 295ded4f
language: ruby language: ruby
rvm: jobs:
- 1.9.3 include:
- 2.0.0 - rvm: 1.9.3
- 2.1 - rvm: 2.0.0
- 2.2 - rvm: 2.1
- 2.3 - rvm: 2.2
- 2.4 - rvm: 2.3
- 2.5 - rvm: 2.4
- ruby-head env: RUBYOPT="--enable-frozen-string-literal"
- jruby-19mode - rvm: 2.5
- rbx-3 env: RUBYOPT="--enable-frozen-string-literal"
- rvm: ruby-head
env: RUBYOPT="--enable-frozen-string-literal"
before_install: before_install:
# 1. The pre-installed Bundler version on Travis is very old; causes 1.9.3 build issues # 1. The pre-installed Bundler version on Travis is very old; causes 1.9.3 build issues
# 2. Bundler 2.0 is not supported by the whole matrix # 2. Bundler 2.0 is not supported by the whole matrix
- gem install bundler -v'< 2' - gem install bundler -v'< 2'
matrix:
allow_failures: script:
- rvm: ruby-head - bundle exec rake
- rvm: rbx-3
# frozen_string_literal: true
require 'mimemagic/tables' require 'mimemagic/tables'
require 'mimemagic/version' require 'mimemagic/version'
...@@ -113,7 +115,7 @@ class MimeMagic ...@@ -113,7 +115,7 @@ class MimeMagic
io.binmode if io.respond_to?(:binmode) io.binmode if io.respond_to?(:binmode)
io.set_encoding(Encoding::BINARY) if io.respond_to?(:set_encoding) io.set_encoding(Encoding::BINARY) if io.respond_to?(:set_encoding)
buffer = "".force_encoding(Encoding::BINARY) buffer = "".encode(Encoding::BINARY)
MAGIC.send(method) { |type, matches| magic_match_io(io, matches, buffer) } MAGIC.send(method) { |type, matches| magic_match_io(io, matches, buffer) }
end end
......
...@@ -44,7 +44,7 @@ class TestMimeMagic < Minitest::Test ...@@ -44,7 +44,7 @@ class TestMimeMagic < Minitest::Test
end end
def test_have_extensions def test_have_extensions
assert_equal %w(htm html), MimeMagic.new('text/html').extensions assert_equal %w(html htm), MimeMagic.new('text/html').extensions
end end
def test_have_comment def test_have_comment
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment