strscan 3.1.0 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rdoc_options +3 -0
- data/doc/strscan/helper_methods.md +128 -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 +1066 -437
- data/lib/strscan/strscan.rb +25 -0
- metadata +39 -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,68 @@
|
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Minero Aoki
|
8
8
|
- Sutou Kouhei
|
9
9
|
- Charles Oliver Nutter
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-12-12 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: Provides lexical scanning operations on a String.
|
16
16
|
email:
|
17
|
-
-
|
17
|
+
-
|
18
18
|
- kou@cozmixng.org
|
19
19
|
- headius@headius.com
|
20
20
|
executables: []
|
21
21
|
extensions:
|
22
22
|
- ext/strscan/extconf.rb
|
23
|
-
extra_rdoc_files:
|
23
|
+
extra_rdoc_files:
|
24
|
+
- ".rdoc_options"
|
25
|
+
- doc/strscan/helper_methods.md
|
26
|
+
- doc/strscan/link_refs.txt
|
27
|
+
- doc/strscan/methods/get_byte.md
|
28
|
+
- doc/strscan/methods/get_charpos.md
|
29
|
+
- doc/strscan/methods/get_pos.md
|
30
|
+
- doc/strscan/methods/getch.md
|
31
|
+
- doc/strscan/methods/scan.md
|
32
|
+
- doc/strscan/methods/scan_until.md
|
33
|
+
- doc/strscan/methods/set_pos.md
|
34
|
+
- doc/strscan/methods/skip.md
|
35
|
+
- doc/strscan/methods/skip_until.md
|
36
|
+
- doc/strscan/methods/terminate.md
|
37
|
+
- doc/strscan/strscan.md
|
24
38
|
files:
|
39
|
+
- ".rdoc_options"
|
25
40
|
- COPYING
|
26
41
|
- LICENSE.txt
|
42
|
+
- doc/strscan/helper_methods.md
|
43
|
+
- doc/strscan/link_refs.txt
|
44
|
+
- doc/strscan/methods/get_byte.md
|
45
|
+
- doc/strscan/methods/get_charpos.md
|
46
|
+
- doc/strscan/methods/get_pos.md
|
47
|
+
- doc/strscan/methods/getch.md
|
48
|
+
- doc/strscan/methods/scan.md
|
49
|
+
- doc/strscan/methods/scan_until.md
|
50
|
+
- doc/strscan/methods/set_pos.md
|
51
|
+
- doc/strscan/methods/skip.md
|
52
|
+
- doc/strscan/methods/skip_until.md
|
53
|
+
- doc/strscan/methods/terminate.md
|
54
|
+
- doc/strscan/strscan.md
|
27
55
|
- ext/strscan/extconf.rb
|
28
56
|
- ext/strscan/strscan.c
|
57
|
+
- lib/strscan/strscan.rb
|
29
58
|
homepage: https://github.com/ruby/strscan
|
30
59
|
licenses:
|
31
60
|
- Ruby
|
32
61
|
- BSD-2-Clause
|
33
62
|
metadata: {}
|
34
|
-
post_install_message:
|
35
|
-
rdoc_options:
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options:
|
65
|
+
- "-idoc"
|
36
66
|
require_paths:
|
37
67
|
- lib
|
38
68
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -46,8 +76,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
76
|
- !ruby/object:Gem::Version
|
47
77
|
version: '0'
|
48
78
|
requirements: []
|
49
|
-
rubygems_version: 3.5.
|
50
|
-
signing_key:
|
79
|
+
rubygems_version: 3.5.22
|
80
|
+
signing_key:
|
51
81
|
specification_version: 4
|
52
82
|
summary: Provides lexical scanning operations on a String.
|
53
83
|
test_files: []
|