unicode_scanner 1.0.1 → 1.0.2

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
  SHA256:
3
- metadata.gz: 544fe42b2d42bf92fd7d75f883dfaaa302bfebe3e5d63915041981f6826fd992
4
- data.tar.gz: ce414e2699c4d09bc6792ba23358ec7a58f8e275d3ba6b849e646528e74c42f3
3
+ metadata.gz: 3c4af50f958a0f776c150b29d75d8be14cae63083027c97700d568962f3ff020
4
+ data.tar.gz: 387b7ad90309e4200a4bbc13d0f62a54ddfbf8a0c58f24f8633a1b92bf927338
5
5
  SHA512:
6
- metadata.gz: c23b7ee2d1604f260fd5007243b71ab8d93b5bedd44c3b3951ed4c462b0210412e7ac0500b28ea2654e6e57c83419e439a55d02434ea8cf20b80119f3bb9b7fe
7
- data.tar.gz: 325d033aa740c34e0d6c819bc62e14ed45f28f769919dc9920d1c24d39552bf7ef153116920fd7481a3c7bce8d0e397eb86c851f009d43726a1741e6a0bb96dd
6
+ metadata.gz: c83dca6ef92d2c0c8feafa4e879ae819dea0526b9c705e62145c18a66e8a0df02011451ef955462e7a5729754cefd716b1d7ecc08726b673b658084a6f227d8b
7
+ data.tar.gz: 45b3d8e86261a69c2ba48d1e7b866a67a2ccbe933f6c591a70ef834854cc162026018546ffc2d53be335c026437f2aef51fb4552723ca1c9997204aabb8a78fe
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.0
1
+ 3.2.0
data/.travis.yml CHANGED
@@ -1,5 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - "3.0"
4
+ - "2.7"
3
5
  - "2.6"
4
6
  - "2.5"
5
7
  before_install:
data/Gemfile CHANGED
@@ -1,11 +1,13 @@
1
- source 'https://rubygems.org'
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
2
4
 
3
5
  group :development do
4
- gem 'rspec'
6
+ gem "rspec"
5
7
 
6
- gem 'redcarpet'
7
- gem 'yard'
8
+ gem "redcarpet"
9
+ gem "yard"
8
10
 
9
- gem 'bundler'
10
- gem 'jeweler'
11
+ gem "bundler"
12
+ gem "jeweler"
11
13
  end
data/Gemfile.lock CHANGED
@@ -5,10 +5,11 @@ GEM
5
5
  builder (3.2.4)
6
6
  descendants_tracker (0.0.4)
7
7
  thread_safe (~> 0.3, >= 0.3.1)
8
- diff-lcs (1.3)
8
+ diff-lcs (1.5.0)
9
9
  faraday (0.9.2)
10
10
  multipart-post (>= 1.2, < 3)
11
- git (1.5.0)
11
+ git (1.11.0)
12
+ rchardet (~> 1.8)
12
13
  github_api (0.16.0)
13
14
  addressable (~> 2.4.0)
14
15
  descendants_tracker (~> 0.0.4)
@@ -16,7 +17,7 @@ GEM
16
17
  hashie (>= 3.4)
17
18
  mime-types (>= 1.16, < 3.0)
18
19
  oauth2 (~> 1.0)
19
- hashie (4.0.0)
20
+ hashie (5.0.0)
20
21
  highline (2.0.3)
21
22
  jeweler (2.3.9)
22
23
  builder
@@ -29,44 +30,53 @@ GEM
29
30
  rake
30
31
  rdoc
31
32
  semver2
32
- jwt (2.2.1)
33
+ jwt (2.6.0)
33
34
  mime-types (2.99.3)
34
- mini_portile2 (2.4.0)
35
- multi_json (1.14.1)
35
+ mini_portile2 (2.8.1)
36
+ multi_json (1.15.0)
36
37
  multi_xml (0.6.0)
37
- multipart-post (2.1.1)
38
- nokogiri (1.10.7)
39
- mini_portile2 (~> 2.4.0)
40
- oauth2 (1.4.2)
41
- faraday (>= 0.8, < 2.0)
38
+ multipart-post (2.2.3)
39
+ nokogiri (1.13.10)
40
+ mini_portile2 (~> 2.8.0)
41
+ racc (~> 1.4)
42
+ oauth2 (1.4.8)
43
+ faraday (>= 0.8, < 3.0)
42
44
  jwt (>= 1.0, < 3.0)
43
45
  multi_json (~> 1.3)
44
46
  multi_xml (~> 0.5)
45
47
  rack (>= 1.2, < 3)
46
- psych (3.1.0)
47
- rack (2.0.8)
48
- rake (13.0.1)
49
- rdoc (6.2.1)
50
- redcarpet (3.5.0)
51
- rspec (3.9.0)
52
- rspec-core (~> 3.9.0)
53
- rspec-expectations (~> 3.9.0)
54
- rspec-mocks (~> 3.9.0)
55
- rspec-core (3.9.0)
56
- rspec-support (~> 3.9.0)
57
- rspec-expectations (3.9.0)
48
+ psych (5.0.1)
49
+ stringio
50
+ racc (1.6.2)
51
+ rack (2.2.5)
52
+ rake (13.0.6)
53
+ rchardet (1.8.0)
54
+ rdoc (6.5.0)
55
+ psych (>= 4.0.0)
56
+ redcarpet (3.5.1)
57
+ rspec (3.12.0)
58
+ rspec-core (~> 3.12.0)
59
+ rspec-expectations (~> 3.12.0)
60
+ rspec-mocks (~> 3.12.0)
61
+ rspec-core (3.12.0)
62
+ rspec-support (~> 3.12.0)
63
+ rspec-expectations (3.12.1)
58
64
  diff-lcs (>= 1.2.0, < 2.0)
59
- rspec-support (~> 3.9.0)
60
- rspec-mocks (3.9.0)
65
+ rspec-support (~> 3.12.0)
66
+ rspec-mocks (3.12.1)
61
67
  diff-lcs (>= 1.2.0, < 2.0)
62
- rspec-support (~> 3.9.0)
63
- rspec-support (3.9.0)
68
+ rspec-support (~> 3.12.0)
69
+ rspec-support (3.12.0)
64
70
  semver2 (3.4.2)
71
+ stringio (3.0.4)
65
72
  thread_safe (0.3.6)
66
- yard (0.9.20)
73
+ webrick (1.7.0)
74
+ yard (0.9.28)
75
+ webrick (~> 1.7.0)
67
76
 
68
77
  PLATFORMS
69
- ruby
78
+ arm64-darwin-22
79
+ x86_64-linux
70
80
 
71
81
  DEPENDENCIES
72
82
  bundler
@@ -76,4 +86,4 @@ DEPENDENCIES
76
86
  yard
77
87
 
78
88
  BUNDLED WITH
79
- 2.1.2
89
+ 2.4.1
data/README.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## ⚠️ DEPRECATED
2
+
3
+ **This gem is no longer actively maintained.** It is stable. Modern Ruby (3.x+) has improved Unicode-aware `StringScanner` behavior; consider the standard library [`StringScanner`](https://docs.ruby-lang.org/en/3.3/StringScanner.html) for new code.
4
+
5
+ ---
6
+
1
7
  Unicode String Scanner
2
8
  ======================
3
9
 
data/Rakefile CHANGED
@@ -1,5 +1,7 @@
1
- require 'rubygems'
2
- require 'bundler'
1
+ # frozen_string_literal: true
2
+
3
+ require "rubygems"
4
+ require "bundler"
3
5
  begin
4
6
  Bundler.setup(:default, :development)
5
7
  rescue Bundler::BundlerError => e
@@ -7,9 +9,9 @@ rescue Bundler::BundlerError => e
7
9
  warn "Run `bundle install` to install missing gems"
8
10
  exit e.status_code
9
11
  end
10
- require 'rake'
12
+ require "rake"
11
13
 
12
- require 'jeweler'
14
+ require "jeweler"
13
15
  Jeweler::Tasks.new do |gem|
14
16
  # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
17
  gem.name = "unicode_scanner"
@@ -23,15 +25,15 @@ Jeweler::Tasks.new do |gem|
23
25
  end
24
26
  Jeweler::RubygemsDotOrgTasks.new
25
27
 
26
- require 'rspec/core'
27
- require 'rspec/core/rake_task'
28
+ require "rspec/core"
29
+ require "rspec/core/rake_task"
28
30
  RSpec::Core::RakeTask.new(:spec) do |spec|
29
- spec.pattern = FileList['spec/**/*_spec.rb']
31
+ spec.pattern = FileList["spec/**/*_spec.rb"]
30
32
  end
31
33
 
32
34
  task default: :spec
33
35
 
34
- require 'yard'
36
+ require "yard"
35
37
 
36
38
  # bring sexy back (sexy == tables)
37
39
  module YARD::Templates::Helpers::HtmlHelper
@@ -40,12 +42,12 @@ module YARD::Templates::Helpers::HtmlHelper
40
42
  end
41
43
  end
42
44
 
43
- YARD::Rake::YardocTask.new('doc') do |doc|
44
- doc.options << '-m' << 'markdown' << '-M' << 'redcarpet'
45
- doc.options << '--protected' << '--no-private'
46
- doc.options << '-r' << 'README.md'
47
- doc.options << '-o' << 'doc'
48
- doc.options << '--title' << 'Unicode String Scanner Documentation'
45
+ YARD::Rake::YardocTask.new("doc") do |doc|
46
+ doc.options << "-m" << "markdown" << "-M" << "redcarpet"
47
+ doc.options << "--protected" << "--no-private"
48
+ doc.options << "-r" << "README.md"
49
+ doc.options << "-o" << "doc"
50
+ doc.options << "--title" << "Unicode String Scanner Documentation"
49
51
 
50
52
  doc.files = %w[lib/**/* README.md]
51
53
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.2
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # UnicodeScanner provides for Unicode-aware lexical scanning operations on a
2
4
  # `String`. Here is an example of its usage:
3
5
  #
@@ -363,7 +365,7 @@ class UnicodeScanner
363
365
  # s.peek(7) # => "test st"
364
366
 
365
367
  def peek(len)
366
- return '' if eos?
368
+ return "" if eos?
367
369
 
368
370
  @string[@current, len]
369
371
  end
@@ -446,7 +448,7 @@ class UnicodeScanner
446
448
  # pointer). If there is no more data (`eos? = true`), it returns `""`.
447
449
 
448
450
  def rest
449
- return '' if eos?
451
+ return "" if eos?
450
452
 
451
453
  return @string[@current, @string.length]
452
454
  end
@@ -630,21 +632,20 @@ class UnicodeScanner
630
632
 
631
633
  @previous = @current
632
634
  @current += @matches.end(0) if advance_pointer
633
- if return_string
634
- return @string[@previous, @matches.end(0)]
635
- else
636
- return @matches.end(0)
637
- end
635
+
636
+ return @string[@previous, @matches.end(0)] if return_string
637
+
638
+ return @matches.end(0)
638
639
  end
639
640
 
640
641
  def inspect_before
641
- return '' if @current.zero?
642
+ return "" if @current.zero?
642
643
 
643
- str = String.new
644
+ str = +""
644
645
  len = 0
645
646
 
646
647
  if @current > INSPECT_LENGTH
647
- str << '...'
648
+ str << "..."
648
649
  len = INSPECT_LENGTH
649
650
  else
650
651
  len = @current
@@ -655,14 +656,14 @@ class UnicodeScanner
655
656
  end
656
657
 
657
658
  def inspect_after
658
- return '' if eos?
659
+ return "" if eos?
659
660
 
660
- str = String.new
661
+ str = +""
661
662
  len = @string.length - @current
662
663
  if len > INSPECT_LENGTH
663
664
  len = INSPECT_LENGTH
664
665
  str << @string[@current, len]
665
- str << '...'
666
+ str << "..."
666
667
  else
667
668
  str << @string[@current, len]
668
669
  end
data/spec/spec_helper.rb CHANGED
@@ -1,11 +1,100 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
3
- require 'rspec'
4
- require 'unicode_scanner'
5
-
6
- # Requires supporting files with custom matchers and macros, etc,
7
- # in ./support/ and its subdirectories.
8
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }
1
+ # frozen_string_literal: true
9
2
 
3
+ # This file was generated by the `rspec --init` command. Conventionally, all
4
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
6
+ # this file to always be loaded, without a need to explicitly require it in any
7
+ # files.
8
+ #
9
+ # Given that it is always loaded, you are encouraged to keep this file as
10
+ # light-weight as possible. Requiring heavyweight dependencies from this file
11
+ # will add to the boot time of your test suite on EVERY test run, even for an
12
+ # individual file that may not need all of that loaded. Instead, consider making
13
+ # a separate helper file that requires the additional dependencies and performs
14
+ # the additional setup, and require it from the spec files that actually need
15
+ # it.
16
+ #
17
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
10
18
  RSpec.configure do |config|
19
+ # rspec-expectations config goes here. You can use an alternate
20
+ # assertion/expectation library such as wrong or the stdlib/minitest
21
+ # assertions if you prefer.
22
+ config.expect_with :rspec do |expectations|
23
+ # This option will default to `true` in RSpec 4. It makes the `description`
24
+ # and `failure_message` of custom matchers include text for helper methods
25
+ # defined using `chain`, e.g.:
26
+ # be_bigger_than(2).and_smaller_than(4).description
27
+ # # => "be bigger than 2 and smaller than 4"
28
+ # ...rather than:
29
+ # # => "be bigger than 2"
30
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
31
+ end
32
+
33
+ # rspec-mocks config goes here. You can use an alternate test double
34
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
35
+ config.mock_with :rspec do |mocks|
36
+ # Prevents you from mocking or stubbing a method that does not exist on
37
+ # a real object. This is generally recommended, and will default to
38
+ # `true` in RSpec 4.
39
+ mocks.verify_partial_doubles = true
40
+ end
41
+
42
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
43
+ # have no way to turn it off -- the option exists only for backwards
44
+ # compatibility in RSpec 3). It causes shared context metadata to be
45
+ # inherited by the metadata hash of host groups and examples, rather than
46
+ # triggering implicit auto-inclusion in groups with matching metadata.
47
+ config.shared_context_metadata_behavior = :apply_to_host_groups
48
+
49
+ # This allows you to limit a spec run to individual examples or groups
50
+ # you care about by tagging them with `:focus` metadata. When nothing
51
+ # is tagged with `:focus`, all examples get run. RSpec also provides
52
+ # aliases for `it`, `describe`, and `context` that include `:focus`
53
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
54
+ config.filter_run_when_matching :focus
55
+
56
+ # Allows RSpec to persist some state between runs in order to support
57
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
58
+ # you configure your source control system to ignore this file.
59
+ config.example_status_persistence_file_path = "spec/examples.txt"
60
+
61
+ # Limits the available syntax to the non-monkey patched syntax that is
62
+ # recommended. For more details, see:
63
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
64
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
65
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
66
+ config.disable_monkey_patching!
67
+
68
+ # This setting enables warnings. It's recommended, but in some cases may
69
+ # be too noisy due to issues in dependencies.
70
+ config.warnings = true
71
+
72
+ # Many RSpec users commonly either run the entire suite or an individual
73
+ # file, and it's useful to allow more verbose output when running an
74
+ # individual spec file.
75
+ if config.files_to_run.one?
76
+ # Use the documentation formatter for detailed output,
77
+ # unless a formatter has already been configured
78
+ # (e.g. via a command-line flag).
79
+ config.default_formatter = "doc"
80
+ end
81
+
82
+ # Print the 10 slowest examples and example groups at the
83
+ # end of the spec run, to help surface which specs are running
84
+ # particularly slow.
85
+ config.profile_examples = 10
86
+
87
+ # Run specs in random order to surface order dependencies. If you find an
88
+ # order dependency and want to debug it, you can fix the order by providing
89
+ # the seed, which is printed after each run.
90
+ # --seed 1234
91
+ config.order = :random
92
+
93
+ # Seed global randomization in this process using the `--seed` CLI option.
94
+ # Setting this allows you to use `--seed` to deterministically reproduce
95
+ # test failures related to randomization by passing the same `--seed` value
96
+ # as the one that triggered the failure.
97
+ Kernel.srand config.seed
11
98
  end
99
+
100
+ require "unicode_scanner"
@@ -1,16 +1,18 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
1
+ # frozen_string_literal: true
2
2
 
3
- describe UnicodeScanner do
4
- it "should pass all the class-level examples" do
5
- s = described_class.new('This is an example string')
6
- expect(s.eos?).to eq(false)
3
+ require File.expand_path("#{File.dirname(__FILE__)}/spec_helper")
4
+
5
+ RSpec.describe UnicodeScanner do
6
+ it "passes all the class-level examples" do
7
+ s = described_class.new("This is an example string")
8
+ expect(s.eos?).to be(false)
7
9
 
8
10
  expect(s.scan(/\w+/)).to eq("This")
9
- expect(s.scan(/\w+/)).to eq(nil)
11
+ expect(s.scan(/\w+/)).to be_nil
10
12
  expect(s.scan(/\s+/)).to eq(" ")
11
- expect(s.scan(/\s+/)).to eq(nil)
13
+ expect(s.scan(/\s+/)).to be_nil
12
14
  expect(s.scan(/\w+/)).to eq("is")
13
- expect(s.eos?).to eq(false)
15
+ expect(s.eos?).to be(false)
14
16
 
15
17
  expect(s.scan(/\s+/)).to eq(" ")
16
18
  expect(s.scan(/\w+/)).to eq("an")
@@ -18,21 +20,21 @@ describe UnicodeScanner do
18
20
  expect(s.scan(/\w+/)).to eq("example")
19
21
  expect(s.scan(/\s+/)).to eq(" ")
20
22
  expect(s.scan(/\w+/)).to eq("string")
21
- expect(s.eos?).to eq(true)
23
+ expect(s.eos?).to be(true)
22
24
 
23
- expect(s.scan(/\s+/)).to eq(nil)
24
- expect(s.scan(/\w+/)).to eq(nil)
25
+ expect(s.scan(/\s+/)).to be_nil
26
+ expect(s.scan(/\w+/)).to be_nil
25
27
  end
26
28
 
27
- it "should pass the #concat example" do
28
- s = described_class.new("Fri Dec 12 1975 14:39")
29
+ it "passes the #concat example" do
30
+ s = described_class.new(+"Fri Dec 12 1975 14:39")
29
31
  s.scan(/Fri /)
30
32
  s << " +1000 GMT"
31
33
  expect(s.string).to eq("Fri Dec 12 1975 14:39 +1000 GMT")
32
34
  expect(s.scan(/Dec/)).to eq("Dec")
33
35
  end
34
36
 
35
- it "should pass the #[] example" do
37
+ it "passes the #[] example" do
36
38
  s = described_class.new("Fri Dec 12 1975 14:39")
37
39
  expect(s.scan(/(\w+) (\w+) (\d+) /)).to eq("Fri Dec 12 ")
38
40
  expect(s[0]).to eq("Fri Dec 12 ")
@@ -43,105 +45,105 @@ describe UnicodeScanner do
43
45
  expect(s.pre_match).to eq("")
44
46
  end
45
47
 
46
- it "should pass the #beginning_of_line? example" do
48
+ it "passes the #beginning_of_line? example" do
47
49
  s = described_class.new("test\ntest\n")
48
- expect(s.bol?).to eq(true)
50
+ expect(s.bol?).to be(true)
49
51
  s.scan(/te/)
50
- expect(s.bol?).to eq(false)
52
+ expect(s.bol?).to be(false)
51
53
  s.scan(/st\n/)
52
- expect(s.bol?).to eq(true)
54
+ expect(s.bol?).to be(true)
53
55
  s.terminate
54
- expect(s.bol?).to eq(true)
56
+ expect(s.bol?).to be(true)
55
57
  end
56
58
 
57
- it "should pass the #check example" do
59
+ it "passes the #check example" do
58
60
  s = described_class.new("Fri Dec 12 1975 14:39")
59
61
  expect(s.check(/Fri/)).to eq("Fri")
60
62
  expect(s.pos).to eq(0)
61
63
  expect(s.matched).to eq("Fri")
62
- expect(s.check(/12/)).to eq(nil)
63
- expect(s.matched).to eq(nil)
64
+ expect(s.check(/12/)).to be_nil
65
+ expect(s.matched).to be_nil
64
66
  end
65
67
 
66
- it "should pass the #check_until example" do
68
+ it "passes the #check_until example" do
67
69
  s = described_class.new("Fri Dec 12 1975 14:39")
68
70
  expect(s.check_until(/12/)).to eq("Fri Dec 12")
69
71
  expect(s.pos).to eq(0)
70
72
  expect(s.matched).to eq("12")
71
73
  end
72
74
 
73
- it "should pass the #eos? example" do
74
- s = described_class.new('test string')
75
- expect(s.eos?).to eq(false)
75
+ it "passes the #eos? example" do
76
+ s = described_class.new("test string")
77
+ expect(s.eos?).to be(false)
76
78
  s.scan(/test/)
77
- expect(s.eos?).to eq(false)
79
+ expect(s.eos?).to be(false)
78
80
  s.terminate
79
- expect(s.eos?).to eq(true)
81
+ expect(s.eos?).to be(true)
80
82
  end
81
83
 
82
- it "should pass the #exist? example" do
83
- s = described_class.new('test string')
84
+ it "passes the #exist? example" do
85
+ s = described_class.new("test string")
84
86
  expect(s.exist?(/s/)).to eq(3)
85
87
  expect(s.scan(/test/)).to eq("test")
86
88
  expect(s.exist?(/s/)).to eq(2)
87
- expect(s.exist?(/e/)).to eq(nil)
89
+ expect(s.exist?(/e/)).to be_nil
88
90
  end
89
91
 
90
- it "should pass a tweaked version of the #getch example" do
92
+ it "passes a tweaked version of the #getch example" do
91
93
  s = described_class.new("ab")
92
94
  expect(s.getch).to eq("a")
93
95
  expect(s.getch).to eq("b")
94
- expect(s.getch).to eq(nil)
96
+ expect(s.getch).to be_nil
95
97
 
96
98
  s = described_class.new("ぁ")
97
99
  expect(s.getch).to eq("ぁ") # Japanese hira-kana "A" in EUC-JP
98
- expect(s.getch).to eq(nil)
100
+ expect(s.getch).to be_nil
99
101
  end
100
102
 
101
- it "should pass the #inspect example" do
103
+ it "passes the #inspect example" do
102
104
  s = described_class.new("Fri Dec 12 1975 14:39")
103
105
  expect(s.inspect).to eq('#<UnicodeScanner 0/21 @ "Fri D...">')
104
106
  expect(s.scan_until(/12/)).to eq("Fri Dec 12")
105
107
  expect(s.inspect).to eq('#<UnicodeScanner 10/21 "...ec 12" @ " 1975...">')
106
108
  end
107
109
 
108
- it "should pass the #match? example" do
109
- s = described_class.new('test string')
110
+ it "passes the #match? example" do
111
+ s = described_class.new("test string")
110
112
  expect(s.match?(/\w+/)).to eq(4)
111
113
  expect(s.match?(/\w+/)).to eq(4)
112
- expect(s.match?(/\s+/)).to eq(nil)
114
+ expect(s.match?(/\s+/)).to be_nil
113
115
  end
114
116
 
115
- it "should pass the #matched example" do
116
- s = described_class.new('test string')
117
+ it "passes the #matched example" do
118
+ s = described_class.new("test string")
117
119
  expect(s.match?(/\w+/)).to eq(4)
118
120
  expect(s.matched).to eq("test")
119
121
  end
120
122
 
121
- it "should pass the #matched? example" do
122
- s = described_class.new('test string')
123
+ it "passes the #matched? example" do
124
+ s = described_class.new("test string")
123
125
  expect(s.match?(/\w+/)).to eq(4)
124
- expect(s.matched?).to eq(true)
125
- expect(s.match?(/\d+/)).to eq(nil)
126
- expect(s.matched?).to eq(false)
126
+ expect(s.matched?).to be(true)
127
+ expect(s.match?(/\d+/)).to be_nil
128
+ expect(s.matched?).to be(false)
127
129
  end
128
130
 
129
- it "should pass the #matched_size example" do
130
- s = described_class.new('test string')
131
+ it "passes the #matched_size example" do
132
+ s = described_class.new("test string")
131
133
  expect(s.check(/\w+/)).to eq("test")
132
134
  expect(s.matched_size).to eq(4)
133
- expect(s.check(/\d+/)).to eq(nil)
134
- expect(s.matched_size).to eq(nil)
135
+ expect(s.check(/\d+/)).to be_nil
136
+ expect(s.matched_size).to be_nil
135
137
  end
136
138
 
137
- it "should pass the #peek example" do
138
- s = described_class.new('test string')
139
+ it "passes the #peek example" do
140
+ s = described_class.new("test string")
139
141
  expect(s.peek(7)).to eq("test st")
140
142
  expect(s.peek(7)).to eq("test st")
141
143
  end
142
144
 
143
- it "should pass the #pos example" do
144
- s = described_class.new('test string')
145
+ it "passes the #pos example" do
146
+ s = described_class.new("test string")
145
147
  expect(s.pos).to eq(0)
146
148
  expect(s.scan_until(/str/)).to eq("test str")
147
149
  expect(s.pos).to eq(8)
@@ -149,56 +151,56 @@ describe UnicodeScanner do
149
151
  expect(s.pos).to eq(11)
150
152
  end
151
153
 
152
- it "should pass the #pos= example" do
153
- s = described_class.new('test string')
154
+ it "passes the #pos= example" do
155
+ s = described_class.new("test string")
154
156
  expect(s.pos = 7).to eq(7)
155
157
  expect(s.rest).to eq("ring")
156
158
  end
157
159
 
158
- it "should pass the #post_match/#pre_match example" do
159
- s = described_class.new('test string')
160
+ it "passes the #post_match/#pre_match example" do
161
+ s = described_class.new("test string")
160
162
  expect(s.scan(/\w+/)).to eq("test")
161
163
  expect(s.scan(/\s+/)).to eq(" ")
162
164
  expect(s.pre_match).to eq("test")
163
165
  expect(s.post_match).to eq("string")
164
166
  end
165
167
 
166
- it "should pass the #scan example" do
167
- s = described_class.new('test string')
168
+ it "passes the #scan example" do
169
+ s = described_class.new("test string")
168
170
  expect(s.scan(/\w+/)).to eq("test")
169
- expect(s.scan(/\w+/)).to eq(nil)
171
+ expect(s.scan(/\w+/)).to be_nil
170
172
  expect(s.scan(/\s+/)).to eq(" ")
171
173
  expect(s.scan(/\w+/)).to eq("string")
172
- expect(s.scan(/./)).to eq(nil)
174
+ expect(s.scan(/./)).to be_nil
173
175
  end
174
176
 
175
- it "should pass the #scan_until example" do
177
+ it "passes the #scan_until example" do
176
178
  s = described_class.new("Fri Dec 12 1975 14:39")
177
179
  expect(s.scan_until(/1/)).to eq("Fri Dec 1")
178
180
  expect(s.pre_match).to eq("Fri Dec ")
179
- expect(s.scan_until(/XYZ/)).to eq(nil)
181
+ expect(s.scan_until(/XYZ/)).to be_nil
180
182
  end
181
183
 
182
- it "should pass the #skip example" do
183
- s = described_class.new('test string')
184
+ it "passes the #skip example" do
185
+ s = described_class.new("test string")
184
186
  expect(s.skip(/\w+/)).to eq(4)
185
- expect(s.skip(/\w+/)).to eq(nil)
187
+ expect(s.skip(/\w+/)).to be_nil
186
188
  expect(s.skip(/\s+/)).to eq(1)
187
189
  expect(s.skip(/\w+/)).to eq(6)
188
- expect(s.skip(/./)).to eq(nil)
190
+ expect(s.skip(/./)).to be_nil
189
191
  end
190
192
 
191
- it "should pass the half-finished #skip_until example" do
193
+ it "passes the half-finished #skip_until example" do
192
194
  s = described_class.new("Fri Dec 12 1975 14:39")
193
195
  expect(s.skip_until(/12/)).to eq(10)
194
196
  end
195
197
 
196
- it "should pass the #unscan example" do
197
- s = described_class.new('test string')
198
+ it "passes the #unscan example" do
199
+ s = described_class.new("test string")
198
200
  expect(s.scan(/\w+/)).to eq("test")
199
201
  s.unscan
200
202
  expect(s.scan(/../)).to eq("te")
201
- expect(s.scan(/\d/)).to eq(nil)
202
- expect { s.unscan }.to raise_error(ScanError, 'unscan failed: previous match record not exist')
203
+ expect(s.scan(/\d/)).to be_nil
204
+ expect { s.unscan }.to raise_error(ScanError, "unscan failed: previous match record not exist")
203
205
  end
204
206
  end
@@ -2,60 +2,69 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+
5
6
  # stub: unicode_scanner 1.0.1 ruby lib
6
7
 
7
8
  Gem::Specification.new do |s|
8
9
  s.name = "unicode_scanner".freeze
9
- s.version = "1.0.1"
10
+ s.version = "1.0.2"
10
11
 
12
+ s.required_ruby_version = '>= 2.5'
11
13
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
14
  s.require_paths = ["lib".freeze]
13
15
  s.authors = ["Tim Morgan".freeze]
14
- s.date = "2019-12-26"
15
16
  s.description = "An implementation of StringScanner that doesn't split multibyte characters.".freeze
16
17
  s.email = "git@timothymorgan.info".freeze
17
18
  s.extra_rdoc_files = [
18
- "LICENSE.txt",
19
- "README.md"
19
+ "LICENSE.txt",
20
+ "README.md"
20
21
  ]
21
22
  s.files = [
22
- ".document",
23
- ".rspec",
24
- ".ruby-gemset",
25
- ".ruby-version",
26
- ".travis.yml",
27
- "Gemfile",
28
- "Gemfile.lock",
29
- "LICENSE.txt",
30
- "README.md",
31
- "Rakefile",
32
- "VERSION",
33
- "lib/unicode_scanner.rb",
34
- "spec/spec_helper.rb",
35
- "spec/unicode_scanner_spec.rb",
36
- "unicode_scanner.gemspec"
23
+ ".document",
24
+ ".rspec",
25
+ ".ruby-gemset",
26
+ ".ruby-version",
27
+ ".travis.yml",
28
+ "Gemfile",
29
+ "Gemfile.lock",
30
+ "LICENSE.txt",
31
+ "README.md",
32
+ "Rakefile",
33
+ "VERSION",
34
+ "lib/unicode_scanner.rb",
35
+ "spec/spec_helper.rb",
36
+ "spec/unicode_scanner_spec.rb",
37
+ "unicode_scanner.gemspec"
37
38
  ]
38
39
  s.homepage = "http://github.com/RISCfuture/unicode_scanner".freeze
39
40
  s.licenses = ["MIT".freeze]
40
41
  s.rubygems_version = "3.1.2".freeze
41
- s.summary = "Unicode-aware implementation of StringScanner".freeze
42
+ s.summary = "[DEPRECATED] Unicode-aware implementation of StringScanner".freeze
43
+ s.post_install_message = <<~MSG
44
+
45
+ ⚠️ DEPRECATED: unicode_scanner is no longer actively maintained.
46
+
47
+ Stable. Modern Ruby (3.x+) has improved Unicode-aware StringScanner behavior; consider the standard library `StringScanner` for new code.
42
48
 
43
- if s.respond_to? :specification_version then
49
+ This is the final release. No further updates are planned.
50
+
51
+ MSG
52
+
53
+ if s.respond_to? :specification_version
44
54
  s.specification_version = 4
45
55
  end
46
56
 
47
- if s.respond_to? :add_runtime_dependency then
48
- s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
49
- s.add_development_dependency(%q<redcarpet>.freeze, [">= 0"])
50
- s.add_development_dependency(%q<yard>.freeze, [">= 0"])
51
- s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
52
- s.add_development_dependency(%q<jeweler>.freeze, [">= 0"])
57
+ if s.respond_to? :add_runtime_dependency
58
+ s.add_development_dependency('rspec'.freeze, [">= 0"])
59
+ s.add_development_dependency('redcarpet'.freeze, [">= 0"])
60
+ s.add_development_dependency('yard'.freeze, [">= 0"])
61
+ s.add_development_dependency('bundler'.freeze, [">= 0"])
62
+ s.add_development_dependency('jeweler'.freeze, [">= 0"])
53
63
  else
54
- s.add_dependency(%q<rspec>.freeze, [">= 0"])
55
- s.add_dependency(%q<redcarpet>.freeze, [">= 0"])
56
- s.add_dependency(%q<yard>.freeze, [">= 0"])
57
- s.add_dependency(%q<bundler>.freeze, [">= 0"])
58
- s.add_dependency(%q<jeweler>.freeze, [">= 0"])
64
+ s.add_dependency('rspec'.freeze, [">= 0"])
65
+ s.add_dependency('redcarpet'.freeze, [">= 0"])
66
+ s.add_dependency('yard'.freeze, [">= 0"])
67
+ s.add_dependency('bundler'.freeze, [">= 0"])
68
+ s.add_dependency('jeweler'.freeze, [">= 0"])
59
69
  end
60
70
  end
61
-
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unicode_scanner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Morgan
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2019-12-26 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rspec
@@ -107,7 +106,14 @@ homepage: http://github.com/RISCfuture/unicode_scanner
107
106
  licenses:
108
107
  - MIT
109
108
  metadata: {}
110
- post_install_message:
109
+ post_install_message: |2+
110
+
111
+ ⚠️ DEPRECATED: unicode_scanner is no longer actively maintained.
112
+
113
+ Stable. Modern Ruby (3.x+) has improved Unicode-aware StringScanner behavior; consider the standard library `StringScanner` for new code.
114
+
115
+ This is the final release. No further updates are planned.
116
+
111
117
  rdoc_options: []
112
118
  require_paths:
113
119
  - lib
@@ -115,15 +121,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
121
  requirements:
116
122
  - - ">="
117
123
  - !ruby/object:Gem::Version
118
- version: '0'
124
+ version: '2.5'
119
125
  required_rubygems_version: !ruby/object:Gem::Requirement
120
126
  requirements:
121
127
  - - ">="
122
128
  - !ruby/object:Gem::Version
123
129
  version: '0'
124
130
  requirements: []
125
- rubygems_version: 3.1.2
126
- signing_key:
131
+ rubygems_version: 4.0.11
127
132
  specification_version: 4
128
- summary: Unicode-aware implementation of StringScanner
133
+ summary: "[DEPRECATED] Unicode-aware implementation of StringScanner"
129
134
  test_files: []
135
+ ...