unicode_scanner 1.0.0 → 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 +7 -0
- data/.rspec +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +9 -0
- data/Gemfile +8 -6
- data/Gemfile.lock +75 -20
- data/README.md +6 -0
- data/Rakefile +20 -20
- data/VERSION +1 -1
- data/lib/unicode_scanner.rb +49 -29
- data/spec/spec_helper.rb +97 -9
- data/spec/unicode_scanner_spec.rb +146 -146
- data/unicode_scanner.gemspec +54 -48
- metadata +33 -41
- data/.rvmrc +0 -1
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 3c4af50f958a0f776c150b29d75d8be14cae63083027c97700d568962f3ff020
|
|
4
|
+
data.tar.gz: 387b7ad90309e4200a4bbc13d0f62a54ddfbf8a0c58f24f8633a1b92bf927338
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: c83dca6ef92d2c0c8feafa4e879ae819dea0526b9c705e62145c18a66e8a0df02011451ef955462e7a5729754cefd716b1d7ecc08726b673b658084a6f227d8b
|
|
7
|
+
data.tar.gz: 45b3d8e86261a69c2ba48d1e7b866a67a2ccbe933f6c591a70ef834854cc162026018546ffc2d53be335c026437f2aef51fb4552723ca1c9997204aabb8a78fe
|
data/.rspec
CHANGED
data/.ruby-gemset
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
scanner
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.2.0
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
2
4
|
|
|
3
5
|
group :development do
|
|
4
|
-
gem
|
|
6
|
+
gem "rspec"
|
|
5
7
|
|
|
6
|
-
gem
|
|
7
|
-
gem
|
|
8
|
+
gem "redcarpet"
|
|
9
|
+
gem "yard"
|
|
8
10
|
|
|
9
|
-
gem
|
|
10
|
-
gem
|
|
11
|
+
gem "bundler"
|
|
12
|
+
gem "jeweler"
|
|
11
13
|
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,30 +1,82 @@
|
|
|
1
1
|
GEM
|
|
2
|
-
remote:
|
|
2
|
+
remote: https://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
addressable (2.4.0)
|
|
5
|
+
builder (3.2.4)
|
|
6
|
+
descendants_tracker (0.0.4)
|
|
7
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
|
8
|
+
diff-lcs (1.5.0)
|
|
9
|
+
faraday (0.9.2)
|
|
10
|
+
multipart-post (>= 1.2, < 3)
|
|
11
|
+
git (1.11.0)
|
|
12
|
+
rchardet (~> 1.8)
|
|
13
|
+
github_api (0.16.0)
|
|
14
|
+
addressable (~> 2.4.0)
|
|
15
|
+
descendants_tracker (~> 0.0.4)
|
|
16
|
+
faraday (~> 0.8, < 0.10)
|
|
17
|
+
hashie (>= 3.4)
|
|
18
|
+
mime-types (>= 1.16, < 3.0)
|
|
19
|
+
oauth2 (~> 1.0)
|
|
20
|
+
hashie (5.0.0)
|
|
21
|
+
highline (2.0.3)
|
|
22
|
+
jeweler (2.3.9)
|
|
23
|
+
builder
|
|
24
|
+
bundler
|
|
8
25
|
git (>= 1.2.5)
|
|
26
|
+
github_api (~> 0.16.0)
|
|
27
|
+
highline (>= 1.6.15)
|
|
28
|
+
nokogiri (>= 1.5.10)
|
|
29
|
+
psych
|
|
9
30
|
rake
|
|
10
31
|
rdoc
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
32
|
+
semver2
|
|
33
|
+
jwt (2.6.0)
|
|
34
|
+
mime-types (2.99.3)
|
|
35
|
+
mini_portile2 (2.8.1)
|
|
36
|
+
multi_json (1.15.0)
|
|
37
|
+
multi_xml (0.6.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)
|
|
44
|
+
jwt (>= 1.0, < 3.0)
|
|
45
|
+
multi_json (~> 1.3)
|
|
46
|
+
multi_xml (~> 0.5)
|
|
47
|
+
rack (>= 1.2, < 3)
|
|
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)
|
|
64
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
65
|
+
rspec-support (~> 3.12.0)
|
|
66
|
+
rspec-mocks (3.12.1)
|
|
67
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
68
|
+
rspec-support (~> 3.12.0)
|
|
69
|
+
rspec-support (3.12.0)
|
|
70
|
+
semver2 (3.4.2)
|
|
71
|
+
stringio (3.0.4)
|
|
72
|
+
thread_safe (0.3.6)
|
|
73
|
+
webrick (1.7.0)
|
|
74
|
+
yard (0.9.28)
|
|
75
|
+
webrick (~> 1.7.0)
|
|
25
76
|
|
|
26
77
|
PLATFORMS
|
|
27
|
-
|
|
78
|
+
arm64-darwin-22
|
|
79
|
+
x86_64-linux
|
|
28
80
|
|
|
29
81
|
DEPENDENCIES
|
|
30
82
|
bundler
|
|
@@ -32,3 +84,6 @@ DEPENDENCIES
|
|
|
32
84
|
redcarpet
|
|
33
85
|
rspec
|
|
34
86
|
yard
|
|
87
|
+
|
|
88
|
+
BUNDLED WITH
|
|
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,39 +1,39 @@
|
|
|
1
|
-
#
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
3
|
+
require "rubygems"
|
|
4
|
+
require "bundler"
|
|
5
5
|
begin
|
|
6
6
|
Bundler.setup(:default, :development)
|
|
7
7
|
rescue Bundler::BundlerError => e
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
warn e.message
|
|
9
|
+
warn "Run `bundle install` to install missing gems"
|
|
10
10
|
exit e.status_code
|
|
11
11
|
end
|
|
12
|
-
require
|
|
12
|
+
require "rake"
|
|
13
13
|
|
|
14
|
-
require
|
|
14
|
+
require "jeweler"
|
|
15
15
|
Jeweler::Tasks.new do |gem|
|
|
16
16
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
|
17
17
|
gem.name = "unicode_scanner"
|
|
18
18
|
gem.homepage = "http://github.com/RISCfuture/unicode_scanner"
|
|
19
19
|
gem.license = "MIT"
|
|
20
|
-
gem.summary = %
|
|
21
|
-
gem.description = %
|
|
20
|
+
gem.summary = %(Unicode-aware implementation of StringScanner)
|
|
21
|
+
gem.description = %(An implementation of StringScanner that doesn't split multibyte characters.)
|
|
22
22
|
gem.email = "git@timothymorgan.info"
|
|
23
23
|
gem.authors = ["Tim Morgan"]
|
|
24
24
|
# dependencies defined in Gemfile
|
|
25
25
|
end
|
|
26
26
|
Jeweler::RubygemsDotOrgTasks.new
|
|
27
27
|
|
|
28
|
-
require
|
|
29
|
-
require
|
|
28
|
+
require "rspec/core"
|
|
29
|
+
require "rspec/core/rake_task"
|
|
30
30
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
31
|
-
spec.pattern = FileList[
|
|
31
|
+
spec.pattern = FileList["spec/**/*_spec.rb"]
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
task default: :spec
|
|
35
35
|
|
|
36
|
-
require
|
|
36
|
+
require "yard"
|
|
37
37
|
|
|
38
38
|
# bring sexy back (sexy == tables)
|
|
39
39
|
module YARD::Templates::Helpers::HtmlHelper
|
|
@@ -42,12 +42,12 @@ module YARD::Templates::Helpers::HtmlHelper
|
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
YARD::Rake::YardocTask.new(
|
|
46
|
-
doc.options <<
|
|
47
|
-
doc.options <<
|
|
48
|
-
doc.options <<
|
|
49
|
-
doc.options <<
|
|
50
|
-
doc.options <<
|
|
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"
|
|
51
51
|
|
|
52
|
-
doc.files = %w
|
|
52
|
+
doc.files = %w[lib/**/* README.md]
|
|
53
53
|
end
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.2
|
data/lib/unicode_scanner.rb
CHANGED
|
@@ -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
|
#
|
|
@@ -165,8 +167,9 @@ class UnicodeScanner
|
|
|
165
167
|
# s.bol? # => true
|
|
166
168
|
|
|
167
169
|
def beginning_of_line?
|
|
168
|
-
return nil if @current > @string.
|
|
169
|
-
return true if @current
|
|
170
|
+
return nil if @current > @string.size
|
|
171
|
+
return true if @current.zero?
|
|
172
|
+
|
|
170
173
|
return @string[@current - 1] == "\n"
|
|
171
174
|
end
|
|
172
175
|
|
|
@@ -259,7 +262,8 @@ class UnicodeScanner
|
|
|
259
262
|
|
|
260
263
|
def getch
|
|
261
264
|
return nil if eos?
|
|
262
|
-
|
|
265
|
+
|
|
266
|
+
do_scan(/./u, true, true, true)
|
|
263
267
|
end
|
|
264
268
|
|
|
265
269
|
# Returns a string that represents the UnicodeScanner object, showing:
|
|
@@ -277,14 +281,23 @@ class UnicodeScanner
|
|
|
277
281
|
# s.inspect # -> '#<UnicodeScanner 10/21 "...ec 12" @ " 1975...">'
|
|
278
282
|
|
|
279
283
|
def inspect
|
|
280
|
-
return "#<#{self.class
|
|
281
|
-
return "#<#{self.class
|
|
282
|
-
|
|
283
|
-
if @current
|
|
284
|
-
return "#<%
|
|
284
|
+
return "#<#{self.class} (uninitialized)>" if @string.nil?
|
|
285
|
+
return "#<#{self.class} fin>" if eos?
|
|
286
|
+
|
|
287
|
+
if @current.zero?
|
|
288
|
+
return format("#<%{class} %<cur>d/%<len>d @ %{after}>",
|
|
289
|
+
class: self.class.to_s,
|
|
290
|
+
cur: @current,
|
|
291
|
+
len: @string.length,
|
|
292
|
+
after: inspect_after.inspect)
|
|
285
293
|
end
|
|
286
294
|
|
|
287
|
-
"#<%
|
|
295
|
+
format("#<%{class} %<cur>d/%<len>d %{before} @ %{after}>",
|
|
296
|
+
class: self.class.to_s,
|
|
297
|
+
cur: @current,
|
|
298
|
+
len: @string.length,
|
|
299
|
+
before: inspect_before.inspect,
|
|
300
|
+
after: inspect_after.inspect)
|
|
288
301
|
end
|
|
289
302
|
|
|
290
303
|
# Tests whether the given `pattern` is matched from the current scan pointer.
|
|
@@ -311,6 +324,7 @@ class UnicodeScanner
|
|
|
311
324
|
|
|
312
325
|
def matched
|
|
313
326
|
return nil unless @matched
|
|
327
|
+
|
|
314
328
|
@matches[0]
|
|
315
329
|
end
|
|
316
330
|
|
|
@@ -335,6 +349,7 @@ class UnicodeScanner
|
|
|
335
349
|
|
|
336
350
|
def matched_size
|
|
337
351
|
return nil unless @matched
|
|
352
|
+
|
|
338
353
|
@matches.end(0) - @matches.begin(0)
|
|
339
354
|
end
|
|
340
355
|
|
|
@@ -350,7 +365,8 @@ class UnicodeScanner
|
|
|
350
365
|
# s.peek(7) # => "test st"
|
|
351
366
|
|
|
352
367
|
def peek(len)
|
|
353
|
-
return
|
|
368
|
+
return "" if eos?
|
|
369
|
+
|
|
354
370
|
@string[@current, len]
|
|
355
371
|
end
|
|
356
372
|
|
|
@@ -384,9 +400,10 @@ class UnicodeScanner
|
|
|
384
400
|
# s.rest # -> "ring"
|
|
385
401
|
|
|
386
402
|
def pos=(n)
|
|
387
|
-
n += @string.length if n
|
|
388
|
-
raise RangeError, "index out of range" if n
|
|
403
|
+
n += @string.length if n.negative?
|
|
404
|
+
raise RangeError, "index out of range" if n.negative?
|
|
389
405
|
raise RangeError, "index out of range" if n > @string.length
|
|
406
|
+
|
|
390
407
|
@current = n
|
|
391
408
|
end
|
|
392
409
|
|
|
@@ -401,6 +418,7 @@ class UnicodeScanner
|
|
|
401
418
|
|
|
402
419
|
def post_match
|
|
403
420
|
return nil unless @matched
|
|
421
|
+
|
|
404
422
|
@string[@previous + @matches.end(0), @string.length]
|
|
405
423
|
end
|
|
406
424
|
|
|
@@ -415,6 +433,7 @@ class UnicodeScanner
|
|
|
415
433
|
|
|
416
434
|
def pre_match
|
|
417
435
|
return nil unless @matched
|
|
436
|
+
|
|
418
437
|
@string[0, @previous + @matches.begin(0)]
|
|
419
438
|
end
|
|
420
439
|
|
|
@@ -429,7 +448,8 @@ class UnicodeScanner
|
|
|
429
448
|
# pointer). If there is no more data (`eos? = true`), it returns `""`.
|
|
430
449
|
|
|
431
450
|
def rest
|
|
432
|
-
return
|
|
451
|
+
return "" if eos?
|
|
452
|
+
|
|
433
453
|
return @string[@current, @string.length]
|
|
434
454
|
end
|
|
435
455
|
|
|
@@ -437,6 +457,7 @@ class UnicodeScanner
|
|
|
437
457
|
|
|
438
458
|
def rest_size
|
|
439
459
|
return 0 if eos?
|
|
460
|
+
|
|
440
461
|
@string.length - @current
|
|
441
462
|
end
|
|
442
463
|
|
|
@@ -550,7 +571,7 @@ class UnicodeScanner
|
|
|
550
571
|
|
|
551
572
|
# @return [String] The string being scanned.
|
|
552
573
|
|
|
553
|
-
|
|
574
|
+
attr_reader :string
|
|
554
575
|
|
|
555
576
|
# Changes the string being scanned to `str` and resets the scanner.
|
|
556
577
|
#
|
|
@@ -561,7 +582,6 @@ class UnicodeScanner
|
|
|
561
582
|
@string = str
|
|
562
583
|
@matched = false
|
|
563
584
|
@current = 0
|
|
564
|
-
str
|
|
565
585
|
end
|
|
566
586
|
|
|
567
587
|
# Set the scan pointer to the end of the string and clear matching data.
|
|
@@ -586,6 +606,7 @@ class UnicodeScanner
|
|
|
586
606
|
|
|
587
607
|
def unscan
|
|
588
608
|
raise ScanError, "unscan failed: previous match record not exist" unless @matched
|
|
609
|
+
|
|
589
610
|
@current = @previous
|
|
590
611
|
@matched = false
|
|
591
612
|
self
|
|
@@ -602,7 +623,7 @@ class UnicodeScanner
|
|
|
602
623
|
@matches = regex.match(@string[@current, @string.length])
|
|
603
624
|
return nil unless @matches
|
|
604
625
|
|
|
605
|
-
if head_only && @matches.begin(0)
|
|
626
|
+
if head_only && @matches.begin(0).positive?
|
|
606
627
|
@matches = nil
|
|
607
628
|
return nil
|
|
608
629
|
end
|
|
@@ -611,21 +632,20 @@ class UnicodeScanner
|
|
|
611
632
|
|
|
612
633
|
@previous = @current
|
|
613
634
|
@current += @matches.end(0) if advance_pointer
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
end
|
|
635
|
+
|
|
636
|
+
return @string[@previous, @matches.end(0)] if return_string
|
|
637
|
+
|
|
638
|
+
return @matches.end(0)
|
|
619
639
|
end
|
|
620
640
|
|
|
621
|
-
def inspect_before
|
|
622
|
-
return
|
|
641
|
+
def inspect_before
|
|
642
|
+
return "" if @current.zero?
|
|
623
643
|
|
|
624
|
-
str =
|
|
644
|
+
str = +""
|
|
625
645
|
len = 0
|
|
626
646
|
|
|
627
647
|
if @current > INSPECT_LENGTH
|
|
628
|
-
str <<
|
|
648
|
+
str << "..."
|
|
629
649
|
len = INSPECT_LENGTH
|
|
630
650
|
else
|
|
631
651
|
len = @current
|
|
@@ -635,15 +655,15 @@ class UnicodeScanner
|
|
|
635
655
|
return str
|
|
636
656
|
end
|
|
637
657
|
|
|
638
|
-
def inspect_after
|
|
639
|
-
return
|
|
658
|
+
def inspect_after
|
|
659
|
+
return "" if eos?
|
|
640
660
|
|
|
641
|
-
str =
|
|
661
|
+
str = +""
|
|
642
662
|
len = @string.length - @current
|
|
643
663
|
if len > INSPECT_LENGTH
|
|
644
664
|
len = INSPECT_LENGTH
|
|
645
665
|
str << @string[@current, len]
|
|
646
|
-
str <<
|
|
666
|
+
str << "..."
|
|
647
667
|
else
|
|
648
668
|
str << @string[@current, len]
|
|
649
669
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,12 +1,100 @@
|
|
|
1
|
-
|
|
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"].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|
|
|
11
|
-
|
|
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
|
|
12
98
|
end
|
|
99
|
+
|
|
100
|
+
require "unicode_scanner"
|
|
@@ -1,206 +1,206 @@
|
|
|
1
|
-
#
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require File.expand_path(File.dirname(__FILE__)
|
|
3
|
+
require File.expand_path("#{File.dirname(__FILE__)}/spec_helper")
|
|
4
4
|
|
|
5
|
-
describe UnicodeScanner do
|
|
6
|
-
it "
|
|
7
|
-
s =
|
|
8
|
-
s.eos
|
|
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)
|
|
9
9
|
|
|
10
|
-
s.scan(/\w+/).
|
|
11
|
-
s.scan(/\w+/).
|
|
12
|
-
s.scan(/\s+/).
|
|
13
|
-
s.scan(/\s+/).
|
|
14
|
-
s.scan(/\w+/).
|
|
15
|
-
s.eos
|
|
10
|
+
expect(s.scan(/\w+/)).to eq("This")
|
|
11
|
+
expect(s.scan(/\w+/)).to be_nil
|
|
12
|
+
expect(s.scan(/\s+/)).to eq(" ")
|
|
13
|
+
expect(s.scan(/\s+/)).to be_nil
|
|
14
|
+
expect(s.scan(/\w+/)).to eq("is")
|
|
15
|
+
expect(s.eos?).to be(false)
|
|
16
16
|
|
|
17
|
-
s.scan(/\s+/).
|
|
18
|
-
s.scan(/\w+/).
|
|
19
|
-
s.scan(/\s+/).
|
|
20
|
-
s.scan(/\w+/).
|
|
21
|
-
s.scan(/\s+/).
|
|
22
|
-
s.scan(/\w+/).
|
|
23
|
-
s.eos
|
|
17
|
+
expect(s.scan(/\s+/)).to eq(" ")
|
|
18
|
+
expect(s.scan(/\w+/)).to eq("an")
|
|
19
|
+
expect(s.scan(/\s+/)).to eq(" ")
|
|
20
|
+
expect(s.scan(/\w+/)).to eq("example")
|
|
21
|
+
expect(s.scan(/\s+/)).to eq(" ")
|
|
22
|
+
expect(s.scan(/\w+/)).to eq("string")
|
|
23
|
+
expect(s.eos?).to be(true)
|
|
24
24
|
|
|
25
|
-
s.scan(/\s+/).
|
|
26
|
-
s.scan(/\w+/).
|
|
25
|
+
expect(s.scan(/\s+/)).to be_nil
|
|
26
|
+
expect(s.scan(/\w+/)).to be_nil
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
it "
|
|
30
|
-
s =
|
|
29
|
+
it "passes the #concat example" do
|
|
30
|
+
s = described_class.new(+"Fri Dec 12 1975 14:39")
|
|
31
31
|
s.scan(/Fri /)
|
|
32
32
|
s << " +1000 GMT"
|
|
33
|
-
s.string.
|
|
34
|
-
s.scan(/Dec/).
|
|
33
|
+
expect(s.string).to eq("Fri Dec 12 1975 14:39 +1000 GMT")
|
|
34
|
+
expect(s.scan(/Dec/)).to eq("Dec")
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
it "
|
|
38
|
-
s =
|
|
39
|
-
s.scan(/(\w+) (\w+) (\d+) /).
|
|
40
|
-
s[0].
|
|
41
|
-
s[1].
|
|
42
|
-
s[2].
|
|
43
|
-
s[3].
|
|
44
|
-
s.post_match.
|
|
45
|
-
s.pre_match.
|
|
37
|
+
it "passes the #[] example" do
|
|
38
|
+
s = described_class.new("Fri Dec 12 1975 14:39")
|
|
39
|
+
expect(s.scan(/(\w+) (\w+) (\d+) /)).to eq("Fri Dec 12 ")
|
|
40
|
+
expect(s[0]).to eq("Fri Dec 12 ")
|
|
41
|
+
expect(s[1]).to eq("Fri")
|
|
42
|
+
expect(s[2]).to eq("Dec")
|
|
43
|
+
expect(s[3]).to eq("12")
|
|
44
|
+
expect(s.post_match).to eq("1975 14:39")
|
|
45
|
+
expect(s.pre_match).to eq("")
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
it "
|
|
49
|
-
s =
|
|
50
|
-
s.bol
|
|
48
|
+
it "passes the #beginning_of_line? example" do
|
|
49
|
+
s = described_class.new("test\ntest\n")
|
|
50
|
+
expect(s.bol?).to be(true)
|
|
51
51
|
s.scan(/te/)
|
|
52
|
-
s.bol
|
|
52
|
+
expect(s.bol?).to be(false)
|
|
53
53
|
s.scan(/st\n/)
|
|
54
|
-
s.bol
|
|
54
|
+
expect(s.bol?).to be(true)
|
|
55
55
|
s.terminate
|
|
56
|
-
s.bol
|
|
56
|
+
expect(s.bol?).to be(true)
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
it "
|
|
60
|
-
s =
|
|
61
|
-
s.check(/Fri/).
|
|
62
|
-
s.pos.
|
|
63
|
-
s.matched.
|
|
64
|
-
s.check(/12/).
|
|
65
|
-
s.matched.
|
|
59
|
+
it "passes the #check example" do
|
|
60
|
+
s = described_class.new("Fri Dec 12 1975 14:39")
|
|
61
|
+
expect(s.check(/Fri/)).to eq("Fri")
|
|
62
|
+
expect(s.pos).to eq(0)
|
|
63
|
+
expect(s.matched).to eq("Fri")
|
|
64
|
+
expect(s.check(/12/)).to be_nil
|
|
65
|
+
expect(s.matched).to be_nil
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
it "
|
|
69
|
-
s =
|
|
70
|
-
s.check_until(/12/).
|
|
71
|
-
s.pos.
|
|
72
|
-
s.matched.
|
|
68
|
+
it "passes the #check_until example" do
|
|
69
|
+
s = described_class.new("Fri Dec 12 1975 14:39")
|
|
70
|
+
expect(s.check_until(/12/)).to eq("Fri Dec 12")
|
|
71
|
+
expect(s.pos).to eq(0)
|
|
72
|
+
expect(s.matched).to eq("12")
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
it "
|
|
76
|
-
s =
|
|
77
|
-
s.eos
|
|
75
|
+
it "passes the #eos? example" do
|
|
76
|
+
s = described_class.new("test string")
|
|
77
|
+
expect(s.eos?).to be(false)
|
|
78
78
|
s.scan(/test/)
|
|
79
|
-
s.eos
|
|
79
|
+
expect(s.eos?).to be(false)
|
|
80
80
|
s.terminate
|
|
81
|
-
s.eos
|
|
81
|
+
expect(s.eos?).to be(true)
|
|
82
82
|
end
|
|
83
83
|
|
|
84
|
-
it "
|
|
85
|
-
s =
|
|
86
|
-
s.exist?(/s/).
|
|
87
|
-
s.scan(/test/).
|
|
88
|
-
s.exist?(/s/).
|
|
89
|
-
s.exist?(/e/).
|
|
84
|
+
it "passes the #exist? example" do
|
|
85
|
+
s = described_class.new("test string")
|
|
86
|
+
expect(s.exist?(/s/)).to eq(3)
|
|
87
|
+
expect(s.scan(/test/)).to eq("test")
|
|
88
|
+
expect(s.exist?(/s/)).to eq(2)
|
|
89
|
+
expect(s.exist?(/e/)).to be_nil
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
-
it "
|
|
93
|
-
s =
|
|
94
|
-
s.getch.
|
|
95
|
-
s.getch.
|
|
96
|
-
s.getch.
|
|
92
|
+
it "passes a tweaked version of the #getch example" do
|
|
93
|
+
s = described_class.new("ab")
|
|
94
|
+
expect(s.getch).to eq("a")
|
|
95
|
+
expect(s.getch).to eq("b")
|
|
96
|
+
expect(s.getch).to be_nil
|
|
97
97
|
|
|
98
|
-
s =
|
|
99
|
-
s.getch.
|
|
100
|
-
s.getch.
|
|
98
|
+
s = described_class.new("ぁ")
|
|
99
|
+
expect(s.getch).to eq("ぁ") # Japanese hira-kana "A" in EUC-JP
|
|
100
|
+
expect(s.getch).to be_nil
|
|
101
101
|
end
|
|
102
102
|
|
|
103
|
-
it "
|
|
104
|
-
s =
|
|
105
|
-
s.inspect.
|
|
106
|
-
s.scan_until(/12/).
|
|
107
|
-
s.inspect.
|
|
103
|
+
it "passes the #inspect example" do
|
|
104
|
+
s = described_class.new("Fri Dec 12 1975 14:39")
|
|
105
|
+
expect(s.inspect).to eq('#<UnicodeScanner 0/21 @ "Fri D...">')
|
|
106
|
+
expect(s.scan_until(/12/)).to eq("Fri Dec 12")
|
|
107
|
+
expect(s.inspect).to eq('#<UnicodeScanner 10/21 "...ec 12" @ " 1975...">')
|
|
108
108
|
end
|
|
109
109
|
|
|
110
|
-
it "
|
|
111
|
-
s =
|
|
112
|
-
s.match?(/\w+/).
|
|
113
|
-
s.match?(/\w+/).
|
|
114
|
-
s.match?(/\s+/).
|
|
110
|
+
it "passes the #match? example" do
|
|
111
|
+
s = described_class.new("test string")
|
|
112
|
+
expect(s.match?(/\w+/)).to eq(4)
|
|
113
|
+
expect(s.match?(/\w+/)).to eq(4)
|
|
114
|
+
expect(s.match?(/\s+/)).to be_nil
|
|
115
115
|
end
|
|
116
116
|
|
|
117
|
-
it "
|
|
118
|
-
s =
|
|
119
|
-
s.match?(/\w+/).
|
|
120
|
-
s.matched.
|
|
117
|
+
it "passes the #matched example" do
|
|
118
|
+
s = described_class.new("test string")
|
|
119
|
+
expect(s.match?(/\w+/)).to eq(4)
|
|
120
|
+
expect(s.matched).to eq("test")
|
|
121
121
|
end
|
|
122
122
|
|
|
123
|
-
it "
|
|
124
|
-
s =
|
|
125
|
-
s.match?(/\w+/).
|
|
126
|
-
s.matched
|
|
127
|
-
s.match?(/\d+/).
|
|
128
|
-
s.matched
|
|
123
|
+
it "passes the #matched? example" do
|
|
124
|
+
s = described_class.new("test string")
|
|
125
|
+
expect(s.match?(/\w+/)).to eq(4)
|
|
126
|
+
expect(s.matched?).to be(true)
|
|
127
|
+
expect(s.match?(/\d+/)).to be_nil
|
|
128
|
+
expect(s.matched?).to be(false)
|
|
129
129
|
end
|
|
130
130
|
|
|
131
|
-
it "
|
|
132
|
-
s =
|
|
133
|
-
s.check(/\w+/).
|
|
134
|
-
s.matched_size.
|
|
135
|
-
s.check(/\d+/).
|
|
136
|
-
s.matched_size.
|
|
131
|
+
it "passes the #matched_size example" do
|
|
132
|
+
s = described_class.new("test string")
|
|
133
|
+
expect(s.check(/\w+/)).to eq("test")
|
|
134
|
+
expect(s.matched_size).to eq(4)
|
|
135
|
+
expect(s.check(/\d+/)).to be_nil
|
|
136
|
+
expect(s.matched_size).to be_nil
|
|
137
137
|
end
|
|
138
138
|
|
|
139
|
-
it "
|
|
140
|
-
s =
|
|
141
|
-
s.peek(7).
|
|
142
|
-
s.peek(7).
|
|
139
|
+
it "passes the #peek example" do
|
|
140
|
+
s = described_class.new("test string")
|
|
141
|
+
expect(s.peek(7)).to eq("test st")
|
|
142
|
+
expect(s.peek(7)).to eq("test st")
|
|
143
143
|
end
|
|
144
144
|
|
|
145
|
-
it "
|
|
146
|
-
s =
|
|
147
|
-
s.pos.
|
|
148
|
-
s.scan_until(/str/).
|
|
149
|
-
s.pos.
|
|
150
|
-
s.terminate.inspect.
|
|
151
|
-
s.pos.
|
|
145
|
+
it "passes the #pos example" do
|
|
146
|
+
s = described_class.new("test string")
|
|
147
|
+
expect(s.pos).to eq(0)
|
|
148
|
+
expect(s.scan_until(/str/)).to eq("test str")
|
|
149
|
+
expect(s.pos).to eq(8)
|
|
150
|
+
expect(s.terminate.inspect).to eq("#<UnicodeScanner fin>")
|
|
151
|
+
expect(s.pos).to eq(11)
|
|
152
152
|
end
|
|
153
153
|
|
|
154
|
-
it "
|
|
155
|
-
s =
|
|
156
|
-
(s.pos = 7).
|
|
157
|
-
s.rest.
|
|
154
|
+
it "passes the #pos= example" do
|
|
155
|
+
s = described_class.new("test string")
|
|
156
|
+
expect(s.pos = 7).to eq(7)
|
|
157
|
+
expect(s.rest).to eq("ring")
|
|
158
158
|
end
|
|
159
159
|
|
|
160
|
-
it "
|
|
161
|
-
s =
|
|
162
|
-
s.scan(/\w+/).
|
|
163
|
-
s.scan(/\s+/).
|
|
164
|
-
s.pre_match.
|
|
165
|
-
s.post_match.
|
|
160
|
+
it "passes the #post_match/#pre_match example" do
|
|
161
|
+
s = described_class.new("test string")
|
|
162
|
+
expect(s.scan(/\w+/)).to eq("test")
|
|
163
|
+
expect(s.scan(/\s+/)).to eq(" ")
|
|
164
|
+
expect(s.pre_match).to eq("test")
|
|
165
|
+
expect(s.post_match).to eq("string")
|
|
166
166
|
end
|
|
167
167
|
|
|
168
|
-
it "
|
|
169
|
-
s =
|
|
170
|
-
s.scan(/\w+/).
|
|
171
|
-
s.scan(/\w+/).
|
|
172
|
-
s.scan(/\s+/).
|
|
173
|
-
s.scan(/\w+/).
|
|
174
|
-
s.scan(/./).
|
|
168
|
+
it "passes the #scan example" do
|
|
169
|
+
s = described_class.new("test string")
|
|
170
|
+
expect(s.scan(/\w+/)).to eq("test")
|
|
171
|
+
expect(s.scan(/\w+/)).to be_nil
|
|
172
|
+
expect(s.scan(/\s+/)).to eq(" ")
|
|
173
|
+
expect(s.scan(/\w+/)).to eq("string")
|
|
174
|
+
expect(s.scan(/./)).to be_nil
|
|
175
175
|
end
|
|
176
176
|
|
|
177
|
-
it "
|
|
178
|
-
s =
|
|
179
|
-
s.scan_until(/1/).
|
|
180
|
-
s.pre_match.
|
|
181
|
-
s.scan_until(/XYZ/).
|
|
177
|
+
it "passes the #scan_until example" do
|
|
178
|
+
s = described_class.new("Fri Dec 12 1975 14:39")
|
|
179
|
+
expect(s.scan_until(/1/)).to eq("Fri Dec 1")
|
|
180
|
+
expect(s.pre_match).to eq("Fri Dec ")
|
|
181
|
+
expect(s.scan_until(/XYZ/)).to be_nil
|
|
182
182
|
end
|
|
183
183
|
|
|
184
|
-
it "
|
|
185
|
-
s =
|
|
186
|
-
s.skip(/\w+/).
|
|
187
|
-
s.skip(/\w+/).
|
|
188
|
-
s.skip(/\s+/).
|
|
189
|
-
s.skip(/\w+/).
|
|
190
|
-
s.skip(/./).
|
|
184
|
+
it "passes the #skip example" do
|
|
185
|
+
s = described_class.new("test string")
|
|
186
|
+
expect(s.skip(/\w+/)).to eq(4)
|
|
187
|
+
expect(s.skip(/\w+/)).to be_nil
|
|
188
|
+
expect(s.skip(/\s+/)).to eq(1)
|
|
189
|
+
expect(s.skip(/\w+/)).to eq(6)
|
|
190
|
+
expect(s.skip(/./)).to be_nil
|
|
191
191
|
end
|
|
192
192
|
|
|
193
|
-
it "
|
|
194
|
-
s =
|
|
195
|
-
s.skip_until(/12/).
|
|
193
|
+
it "passes the half-finished #skip_until example" do
|
|
194
|
+
s = described_class.new("Fri Dec 12 1975 14:39")
|
|
195
|
+
expect(s.skip_until(/12/)).to eq(10)
|
|
196
196
|
end
|
|
197
197
|
|
|
198
|
-
it "
|
|
199
|
-
s =
|
|
200
|
-
s.scan(/\w+/).
|
|
198
|
+
it "passes the #unscan example" do
|
|
199
|
+
s = described_class.new("test string")
|
|
200
|
+
expect(s.scan(/\w+/)).to eq("test")
|
|
201
201
|
s.unscan
|
|
202
|
-
s.scan(/../).
|
|
203
|
-
s.scan(/\d/).
|
|
204
|
-
|
|
202
|
+
expect(s.scan(/../)).to eq("te")
|
|
203
|
+
expect(s.scan(/\d/)).to be_nil
|
|
204
|
+
expect { s.unscan }.to raise_error(ScanError, "unscan failed: previous match record not exist")
|
|
205
205
|
end
|
|
206
206
|
end
|
data/unicode_scanner.gemspec
CHANGED
|
@@ -3,62 +3,68 @@
|
|
|
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
|
|
7
|
+
|
|
6
8
|
Gem::Specification.new do |s|
|
|
7
|
-
s.name = "unicode_scanner"
|
|
8
|
-
s.version = "1.0.
|
|
9
|
+
s.name = "unicode_scanner".freeze
|
|
10
|
+
s.version = "1.0.2"
|
|
9
11
|
|
|
10
|
-
s.
|
|
11
|
-
s.
|
|
12
|
-
s.
|
|
13
|
-
s.
|
|
14
|
-
s.
|
|
12
|
+
s.required_ruby_version = '>= 2.5'
|
|
13
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
14
|
+
s.require_paths = ["lib".freeze]
|
|
15
|
+
s.authors = ["Tim Morgan".freeze]
|
|
16
|
+
s.description = "An implementation of StringScanner that doesn't split multibyte characters.".freeze
|
|
17
|
+
s.email = "git@timothymorgan.info".freeze
|
|
15
18
|
s.extra_rdoc_files = [
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
"LICENSE.txt",
|
|
20
|
+
"README.md"
|
|
18
21
|
]
|
|
19
22
|
s.files = [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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"
|
|
33
38
|
]
|
|
34
|
-
s.homepage = "http://github.com/RISCfuture/unicode_scanner"
|
|
35
|
-
s.licenses = ["MIT"]
|
|
36
|
-
s.
|
|
37
|
-
s.
|
|
38
|
-
s.
|
|
39
|
+
s.homepage = "http://github.com/RISCfuture/unicode_scanner".freeze
|
|
40
|
+
s.licenses = ["MIT".freeze]
|
|
41
|
+
s.rubygems_version = "3.1.2".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.
|
|
48
|
+
|
|
49
|
+
This is the final release. No further updates are planned.
|
|
39
50
|
|
|
40
|
-
|
|
41
|
-
s.specification_version = 3
|
|
51
|
+
MSG
|
|
42
52
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
s.add_dependency(%q<bundler>, [">= 0"])
|
|
54
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
|
55
|
-
end
|
|
53
|
+
if s.respond_to? :specification_version
|
|
54
|
+
s.specification_version = 4
|
|
55
|
+
end
|
|
56
|
+
|
|
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"])
|
|
56
63
|
else
|
|
57
|
-
s.add_dependency(
|
|
58
|
-
s.add_dependency(
|
|
59
|
-
s.add_dependency(
|
|
60
|
-
s.add_dependency(
|
|
61
|
-
s.add_dependency(
|
|
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"])
|
|
62
69
|
end
|
|
63
70
|
end
|
|
64
|
-
|
metadata
CHANGED
|
@@ -1,94 +1,82 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: unicode_scanner
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 1.0.2
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Tim Morgan
|
|
9
|
-
autorequire:
|
|
10
8
|
bindir: bin
|
|
11
9
|
cert_chain: []
|
|
12
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
11
|
dependencies:
|
|
14
12
|
- !ruby/object:Gem::Dependency
|
|
15
13
|
name: rspec
|
|
16
14
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
-
none: false
|
|
18
15
|
requirements:
|
|
19
|
-
- -
|
|
16
|
+
- - ">="
|
|
20
17
|
- !ruby/object:Gem::Version
|
|
21
18
|
version: '0'
|
|
22
19
|
type: :development
|
|
23
20
|
prerelease: false
|
|
24
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
none: false
|
|
26
22
|
requirements:
|
|
27
|
-
- -
|
|
23
|
+
- - ">="
|
|
28
24
|
- !ruby/object:Gem::Version
|
|
29
25
|
version: '0'
|
|
30
26
|
- !ruby/object:Gem::Dependency
|
|
31
27
|
name: redcarpet
|
|
32
28
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
none: false
|
|
34
29
|
requirements:
|
|
35
|
-
- -
|
|
30
|
+
- - ">="
|
|
36
31
|
- !ruby/object:Gem::Version
|
|
37
32
|
version: '0'
|
|
38
33
|
type: :development
|
|
39
34
|
prerelease: false
|
|
40
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
-
none: false
|
|
42
36
|
requirements:
|
|
43
|
-
- -
|
|
37
|
+
- - ">="
|
|
44
38
|
- !ruby/object:Gem::Version
|
|
45
39
|
version: '0'
|
|
46
40
|
- !ruby/object:Gem::Dependency
|
|
47
41
|
name: yard
|
|
48
42
|
requirement: !ruby/object:Gem::Requirement
|
|
49
|
-
none: false
|
|
50
43
|
requirements:
|
|
51
|
-
- -
|
|
44
|
+
- - ">="
|
|
52
45
|
- !ruby/object:Gem::Version
|
|
53
46
|
version: '0'
|
|
54
47
|
type: :development
|
|
55
48
|
prerelease: false
|
|
56
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
none: false
|
|
58
50
|
requirements:
|
|
59
|
-
- -
|
|
51
|
+
- - ">="
|
|
60
52
|
- !ruby/object:Gem::Version
|
|
61
53
|
version: '0'
|
|
62
54
|
- !ruby/object:Gem::Dependency
|
|
63
55
|
name: bundler
|
|
64
56
|
requirement: !ruby/object:Gem::Requirement
|
|
65
|
-
none: false
|
|
66
57
|
requirements:
|
|
67
|
-
- -
|
|
58
|
+
- - ">="
|
|
68
59
|
- !ruby/object:Gem::Version
|
|
69
60
|
version: '0'
|
|
70
61
|
type: :development
|
|
71
62
|
prerelease: false
|
|
72
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
-
none: false
|
|
74
64
|
requirements:
|
|
75
|
-
- -
|
|
65
|
+
- - ">="
|
|
76
66
|
- !ruby/object:Gem::Version
|
|
77
67
|
version: '0'
|
|
78
68
|
- !ruby/object:Gem::Dependency
|
|
79
69
|
name: jeweler
|
|
80
70
|
requirement: !ruby/object:Gem::Requirement
|
|
81
|
-
none: false
|
|
82
71
|
requirements:
|
|
83
|
-
- -
|
|
72
|
+
- - ">="
|
|
84
73
|
- !ruby/object:Gem::Version
|
|
85
74
|
version: '0'
|
|
86
75
|
type: :development
|
|
87
76
|
prerelease: false
|
|
88
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
-
none: false
|
|
90
78
|
requirements:
|
|
91
|
-
- -
|
|
79
|
+
- - ">="
|
|
92
80
|
- !ruby/object:Gem::Version
|
|
93
81
|
version: '0'
|
|
94
82
|
description: An implementation of StringScanner that doesn't split multibyte characters.
|
|
@@ -99,9 +87,11 @@ extra_rdoc_files:
|
|
|
99
87
|
- LICENSE.txt
|
|
100
88
|
- README.md
|
|
101
89
|
files:
|
|
102
|
-
- .document
|
|
103
|
-
- .rspec
|
|
104
|
-
- .
|
|
90
|
+
- ".document"
|
|
91
|
+
- ".rspec"
|
|
92
|
+
- ".ruby-gemset"
|
|
93
|
+
- ".ruby-version"
|
|
94
|
+
- ".travis.yml"
|
|
105
95
|
- Gemfile
|
|
106
96
|
- Gemfile.lock
|
|
107
97
|
- LICENSE.txt
|
|
@@ -115,29 +105,31 @@ files:
|
|
|
115
105
|
homepage: http://github.com/RISCfuture/unicode_scanner
|
|
116
106
|
licenses:
|
|
117
107
|
- MIT
|
|
118
|
-
|
|
108
|
+
metadata: {}
|
|
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
|
+
|
|
119
117
|
rdoc_options: []
|
|
120
118
|
require_paths:
|
|
121
119
|
- lib
|
|
122
120
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
|
-
none: false
|
|
124
121
|
requirements:
|
|
125
|
-
- -
|
|
122
|
+
- - ">="
|
|
126
123
|
- !ruby/object:Gem::Version
|
|
127
|
-
version: '
|
|
128
|
-
segments:
|
|
129
|
-
- 0
|
|
130
|
-
hash: -3935821298050612576
|
|
124
|
+
version: '2.5'
|
|
131
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
|
-
none: false
|
|
133
126
|
requirements:
|
|
134
|
-
- -
|
|
127
|
+
- - ">="
|
|
135
128
|
- !ruby/object:Gem::Version
|
|
136
129
|
version: '0'
|
|
137
130
|
requirements: []
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
specification_version: 3
|
|
142
|
-
summary: Unicode-aware implementation of StringScanner
|
|
131
|
+
rubygems_version: 4.0.11
|
|
132
|
+
specification_version: 4
|
|
133
|
+
summary: "[DEPRECATED] Unicode-aware implementation of StringScanner"
|
|
143
134
|
test_files: []
|
|
135
|
+
...
|
data/.rvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
rvm 1.9.3@scanner --create
|