strscan 3.1.0 → 3.1.4
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 +4 -4
- data/.rdoc_options +3 -0
- data/doc/strscan/helper_methods.md +124 -0
- data/doc/strscan/link_refs.txt +17 -0
- data/doc/strscan/methods/get_byte.md +30 -0
- data/doc/strscan/methods/get_charpos.md +19 -0
- data/doc/strscan/methods/get_pos.md +14 -0
- data/doc/strscan/methods/getch.md +43 -0
- data/doc/strscan/methods/scan.md +51 -0
- data/doc/strscan/methods/scan_until.md +52 -0
- data/doc/strscan/methods/set_pos.md +27 -0
- data/doc/strscan/methods/skip.md +43 -0
- data/doc/strscan/methods/skip_until.md +49 -0
- data/doc/strscan/methods/terminate.md +30 -0
- data/doc/strscan/strscan.md +544 -0
- data/ext/strscan/strscan.c +1096 -460
- data/lib/strscan/strscan.rb +25 -0
- metadata +36 -9
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class StringScanner
|
4
|
+
# call-seq:
|
5
|
+
# scan_integer(base: 10)
|
6
|
+
#
|
7
|
+
# If `base` isn't provided or is `10`, then it is equivalent to calling `#scan` with a `[+-]?\d+` pattern,
|
8
|
+
# and returns an Integer or nil.
|
9
|
+
#
|
10
|
+
# If `base` is `16`, then it is equivalent to calling `#scan` with a `[+-]?(0x)?[0-9a-fA-F]+` pattern,
|
11
|
+
# and returns an Integer or nil.
|
12
|
+
#
|
13
|
+
# The scanned string must be encoded with an ASCII compatible encoding, otherwise
|
14
|
+
# Encoding::CompatibilityError will be raised.
|
15
|
+
def scan_integer(base: 10)
|
16
|
+
case base
|
17
|
+
when 10
|
18
|
+
scan_base10_integer
|
19
|
+
when 16
|
20
|
+
scan_base16_integer
|
21
|
+
else
|
22
|
+
raise ArgumentError, "Unsupported integer base: #{base.inspect}, expected 10 or 16"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,38 +1,66 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strscan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Minero Aoki
|
8
8
|
- Sutou Kouhei
|
9
9
|
- Charles Oliver Nutter
|
10
|
-
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
14
13
|
dependencies: []
|
15
14
|
description: Provides lexical scanning operations on a String.
|
16
15
|
email:
|
17
|
-
-
|
16
|
+
-
|
18
17
|
- kou@cozmixng.org
|
19
18
|
- headius@headius.com
|
20
19
|
executables: []
|
21
20
|
extensions:
|
22
21
|
- ext/strscan/extconf.rb
|
23
|
-
extra_rdoc_files:
|
22
|
+
extra_rdoc_files:
|
23
|
+
- ".rdoc_options"
|
24
|
+
- doc/strscan/helper_methods.md
|
25
|
+
- doc/strscan/link_refs.txt
|
26
|
+
- doc/strscan/methods/get_byte.md
|
27
|
+
- doc/strscan/methods/get_charpos.md
|
28
|
+
- doc/strscan/methods/get_pos.md
|
29
|
+
- doc/strscan/methods/getch.md
|
30
|
+
- doc/strscan/methods/scan.md
|
31
|
+
- doc/strscan/methods/scan_until.md
|
32
|
+
- doc/strscan/methods/set_pos.md
|
33
|
+
- doc/strscan/methods/skip.md
|
34
|
+
- doc/strscan/methods/skip_until.md
|
35
|
+
- doc/strscan/methods/terminate.md
|
36
|
+
- doc/strscan/strscan.md
|
24
37
|
files:
|
38
|
+
- ".rdoc_options"
|
25
39
|
- COPYING
|
26
40
|
- LICENSE.txt
|
41
|
+
- doc/strscan/helper_methods.md
|
42
|
+
- doc/strscan/link_refs.txt
|
43
|
+
- doc/strscan/methods/get_byte.md
|
44
|
+
- doc/strscan/methods/get_charpos.md
|
45
|
+
- doc/strscan/methods/get_pos.md
|
46
|
+
- doc/strscan/methods/getch.md
|
47
|
+
- doc/strscan/methods/scan.md
|
48
|
+
- doc/strscan/methods/scan_until.md
|
49
|
+
- doc/strscan/methods/set_pos.md
|
50
|
+
- doc/strscan/methods/skip.md
|
51
|
+
- doc/strscan/methods/skip_until.md
|
52
|
+
- doc/strscan/methods/terminate.md
|
53
|
+
- doc/strscan/strscan.md
|
27
54
|
- ext/strscan/extconf.rb
|
28
55
|
- ext/strscan/strscan.c
|
56
|
+
- lib/strscan/strscan.rb
|
29
57
|
homepage: https://github.com/ruby/strscan
|
30
58
|
licenses:
|
31
59
|
- Ruby
|
32
60
|
- BSD-2-Clause
|
33
61
|
metadata: {}
|
34
|
-
|
35
|
-
|
62
|
+
rdoc_options:
|
63
|
+
- "-idoc"
|
36
64
|
require_paths:
|
37
65
|
- lib
|
38
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -46,8 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
74
|
- !ruby/object:Gem::Version
|
47
75
|
version: '0'
|
48
76
|
requirements: []
|
49
|
-
rubygems_version: 3.
|
50
|
-
signing_key:
|
77
|
+
rubygems_version: 3.6.7
|
51
78
|
specification_version: 4
|
52
79
|
summary: Provides lexical scanning operations on a String.
|
53
80
|
test_files: []
|