pygments.rb 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95f44f119ac71a42def88c2cc6684c051d6a7bc1
4
- data.tar.gz: d44710b3e2e2d6b694379a8edb394caf45d7e1ac
3
+ metadata.gz: 5021687249edac6151faaec1cec0187dea8eb311
4
+ data.tar.gz: f61e48727a7eb866ee5c5bd549ddce136095efc2
5
5
  SHA512:
6
- metadata.gz: 8aa00980332c0b813fb5c1bbffdcbeca857dcf306c8504a1dbd3c77e77a5b442723d3e112a5e04906706def6115dac67153ed3d0f2a5e80aaf978f0868484de8
7
- data.tar.gz: fb638bccbcc5b1ddd9ea6c9ce46df79c4019f44bf342571f800f21313ef6b93f1a46c1f17c9ce120dc945ac9910b88d79b259af767dd725f2f79463f49c2d2bb
6
+ metadata.gz: 05ec911f5a0aa423dd24da7ad7a4228989170790dee007347e401745c64d5c5fbc29b43cbe9e6a43f499f46ca5af8c504d0e0e29c2272aeb82fbcee524401b69
7
+ data.tar.gz: b93056fd8b559770b234958660c4643ac400cbedfcf65df9e20dfcf859651b75d3361b1723506ed6bf18d7ab30de128d15ca65ae2454974f73e345b8cc4bed9b
@@ -1,6 +1,11 @@
1
1
  changelog
2
2
  ===========
3
3
 
4
+ Version 1.1.1 (2016/12/28)
5
+ -----------------------------
6
+
7
+ * Suppress Ruby 2.4.0's warnings [#172](https://github.com/tmm1/pygments.rb/pull/172)
8
+ * Enable `frozen_string_literal` [#173](https://github.com/tmm1/pygments.rb/pull/173)
4
9
 
5
10
  Version 1.1.0 (2016/12/24)
6
11
  -----------------------------
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
1
3
  require File.join(File.dirname(__FILE__), 'pygments/popen')
2
4
  require 'forwardable'
3
5
 
@@ -14,7 +16,6 @@ module Pygments
14
16
  end
15
17
 
16
18
  def_delegators :engine,
17
- # public
18
19
  :formatters,
19
20
  :lexers,
20
21
  :lexers!,
@@ -23,11 +24,6 @@ module Pygments
23
24
  :css,
24
25
  :lexer_name_for,
25
26
  :highlight,
26
- # not public but documented
27
- :start,
28
- # only for testing
29
- :size_check,
30
- :get_fixed_bits_from_header,
31
- :add_ids
27
+ :start
32
28
  end
33
29
  end
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
1
3
  module Pygments
2
4
  class Lexer < Struct.new(:name, :aliases, :filenames, :mimetypes)
3
5
  @lexers = []
@@ -1,4 +1,6 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require 'open3'
3
5
  require 'multi_json'
4
6
  require 'timeout'
@@ -371,9 +373,7 @@ module Pygments
371
373
  # id, with two padding also. This means we are sending over the 8 characters +
372
374
  # code + 8 characters.
373
375
  def add_ids(code, id)
374
- code.freeze
375
- code = id + " #{code} #{id}"
376
- code
376
+ (id + " #{code} #{id}").freeze
377
377
  end
378
378
 
379
379
  # Write data to mentos, the Python process.
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
1
3
  module Pygments
2
- VERSION = '1.1.0'
4
+ VERSION = '1.1.1'
3
5
  end
@@ -1,10 +1,13 @@
1
- #coding: utf-8
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'test/unit'
4
5
  require File.join(File.dirname(__FILE__), '..', '/lib/pygments.rb')
5
6
  ENV['mentos-test'] = "yes"
6
7
 
8
+
7
9
  P = Pygments
10
+ PE = Pygments.engine
8
11
 
9
12
  class PygmentsHighlightTest < Test::Unit::TestCase
10
13
  RUBY_CODE = "#!/usr/bin/ruby\nputs 'foo'"
@@ -129,44 +132,44 @@ end
129
132
  # over the pipe I think it's necessary and informative.
130
133
  class PygmentsValidityTest < Test::Unit::TestCase
131
134
  def test_add_ids_with_padding
132
- res = P.send(:add_ids, "herp derp baz boo foo", "ABCDEFGH")
135
+ res = PE.send(:add_ids, "herp derp baz boo foo", "ABCDEFGH")
133
136
  assert_equal "ABCDEFGH herp derp baz boo foo ABCDEFGH", res
134
137
  end
135
138
 
136
139
  def test_add_ids_on_empty_string
137
- res = P.send(:add_ids, "", "ABCDEFGH")
140
+ res = PE.send(:add_ids, "", "ABCDEFGH")
138
141
  assert_equal "ABCDEFGH ABCDEFGH", res
139
142
  end
140
143
 
141
144
  def test_add_ids_with_unicode_data
142
- res = P.send(:add_ids, "# ø ø ø", "ABCDEFGH")
145
+ res = PE.send(:add_ids, "# ø ø ø", "ABCDEFGH")
143
146
  assert_equal "ABCDEFGH # ø ø ø ABCDEFGH", res
144
147
  end
145
148
 
146
149
  def test_add_ids_with_starting_slashes
147
- res = P.send(:add_ids, '\\# ø ø ø..//', "ABCDEFGH")
150
+ res = PE.send(:add_ids, '\\# ø ø ø..//', "ABCDEFGH")
148
151
  assert_equal "ABCDEFGH \\# ø ø ø..// ABCDEFGH", res
149
152
  end
150
153
 
151
154
  def test_get_fixed_bits_from_header
152
- bits = P.send(:get_fixed_bits_from_header, '{"herp": "derp"}')
155
+ bits = PE.send(:get_fixed_bits_from_header, '{"herp": "derp"}')
153
156
  assert_equal "00000000000000000000000000010000", bits
154
157
  end
155
158
 
156
159
  def test_get_fixed_bits_from_header_works_with_large_headers
157
- bits = P.send(:get_fixed_bits_from_header, '{"herp": "derp"}' * 10000)
160
+ bits = PE.send(:get_fixed_bits_from_header, '{"herp": "derp"}' * 10000)
158
161
  assert_equal "00000000000000100111000100000000", bits
159
162
  end
160
163
 
161
164
  def test_size_check
162
165
  size = "00000000000000000000000000100110"
163
- res = P.send(:size_check, size)
166
+ res = PE.send(:size_check, size)
164
167
  assert_equal res, true
165
168
  end
166
169
 
167
170
  def test_size_check_bad
168
171
  size = "some random thing"
169
- res = P.send(:size_check, size)
172
+ res = PE.send(:size_check, size)
170
173
  assert_equal res, false
171
174
  end
172
175
  end
@@ -1 +1 @@
1
- debug_lexer.py
1
+ vendor/pygments-main/scripts/debug_lexer.py
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pygments.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aman Gupta
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-12-24 00:00:00.000000000 Z
12
+ date: 2016-12-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -411,7 +411,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
411
411
  version: '0'
412
412
  requirements: []
413
413
  rubyforge_project:
414
- rubygems_version: 2.5.1
414
+ rubygems_version: 2.6.8
415
415
  signing_key:
416
416
  specification_version: 4
417
417
  summary: pygments wrapper for ruby