chars 0.2.0 → 0.2.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 +7 -0
- data/.document +1 -1
- data/.gemspec +0 -0
- data/.github/workflows/ruby.yml +28 -0
- data/.gitignore +8 -0
- data/.yardopts +1 -1
- data/ChangeLog.md +30 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +1 -1
- data/README.md +79 -46
- data/Rakefile +7 -30
- data/benchmarks/compare.rb +16 -0
- data/benchmarks/strings_in.rb +23 -0
- data/chars.gemspec +58 -7
- data/gemspec.yml +10 -4
- data/lib/chars/char_set.rb +193 -94
- data/lib/chars/chars.rb +78 -38
- data/lib/chars/extensions/integer.rb +51 -34
- data/lib/chars/extensions/string.rb +34 -17
- data/lib/chars/version.rb +2 -2
- data/spec/char_set_spec.rb +236 -133
- data/spec/chars_spec.rb +14 -73
- data/spec/{integer_spec.rb → extensions/integer_spec.rb} +19 -20
- data/spec/{string_spec.rb → extensions/string_spec.rb} +20 -19
- data/spec/spec_helper.rb +0 -1
- metadata +56 -98
@@ -1,74 +1,73 @@
|
|
1
|
-
require 'chars/extensions/integer'
|
2
|
-
|
3
1
|
require 'spec_helper'
|
2
|
+
require 'chars/extensions/integer'
|
4
3
|
|
5
4
|
describe Integer do
|
6
5
|
it "should recognize numeric bytes" do
|
7
|
-
0x39.
|
6
|
+
expect(0x39).to be_numeric
|
8
7
|
end
|
9
8
|
|
10
9
|
it "should recognize octal bytes" do
|
11
|
-
0x30.
|
10
|
+
expect(0x30).to be_octal
|
12
11
|
end
|
13
12
|
|
14
13
|
it "should recognize upper-case hexadecimal bytes" do
|
15
|
-
0x44.
|
14
|
+
expect(0x44).to be_uppercase_hex
|
16
15
|
end
|
17
16
|
|
18
17
|
it "should recognize lower-case hexadecimal bytes" do
|
19
|
-
0x61.
|
18
|
+
expect(0x61).to be_lowercase_hex
|
20
19
|
end
|
21
20
|
|
22
21
|
it "should recognize hexadecimal bytes" do
|
23
|
-
0x63.
|
22
|
+
expect(0x63).to be_hex
|
24
23
|
end
|
25
24
|
|
26
25
|
it "should recognize upper-case alpha bytes" do
|
27
|
-
0x4c.
|
26
|
+
expect(0x4c).to be_uppercase_alpha
|
28
27
|
end
|
29
28
|
|
30
29
|
it "should recognize lower-case alpha bytes" do
|
31
|
-
0x71.
|
30
|
+
expect(0x71).to be_lowercase_alpha
|
32
31
|
end
|
33
32
|
|
34
33
|
it "should recognize alpha bytes" do
|
35
|
-
0x7a.
|
34
|
+
expect(0x7a).to be_alpha
|
36
35
|
end
|
37
36
|
|
38
37
|
it "should recognize alpha-numeric bytes" do
|
39
|
-
0x69.
|
38
|
+
expect(0x69).to be_alpha_numeric
|
40
39
|
end
|
41
40
|
|
42
41
|
it "should recognize punctuation bytes" do
|
43
|
-
0x60.
|
42
|
+
expect(0x60).to be_punctuation
|
44
43
|
end
|
45
44
|
|
46
45
|
it "should recognize symbolic bytes" do
|
47
|
-
0x26.
|
46
|
+
expect(0x26).to be_symbolic
|
48
47
|
end
|
49
48
|
|
50
49
|
it "should recognize space bytes" do
|
51
|
-
0x20.
|
50
|
+
expect(0x20).to be_space
|
52
51
|
end
|
53
52
|
|
54
53
|
it "should recognize visible bytes" do
|
55
|
-
0x41.
|
56
|
-
0x20.
|
54
|
+
expect(0x41).to be_visible
|
55
|
+
expect(0x20).to_not be_visible
|
57
56
|
end
|
58
57
|
|
59
58
|
it "should recognize printable bytes" do
|
60
|
-
0x3f.
|
59
|
+
expect(0x3f).to be_printable
|
61
60
|
end
|
62
61
|
|
63
62
|
it "should recognize control bytes" do
|
64
|
-
0x1b.
|
63
|
+
expect(0x1b).to be_control
|
65
64
|
end
|
66
65
|
|
67
66
|
it "should recognize signed ASCII bytes" do
|
68
|
-
0x00.
|
67
|
+
expect(0x00).to be_signed_ascii
|
69
68
|
end
|
70
69
|
|
71
70
|
it "should recognize ASCII bytes" do
|
72
|
-
0x80.
|
71
|
+
expect(0x80).to be_ascii
|
73
72
|
end
|
74
73
|
end
|
@@ -1,74 +1,75 @@
|
|
1
|
-
|
1
|
+
# encoding: US-ASCII
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
|
+
require 'chars/extensions/string'
|
4
5
|
|
5
6
|
describe String do
|
6
7
|
it "should recognize numeric strings" do
|
7
|
-
"0987".
|
8
|
+
expect("0987").to be_numeric
|
8
9
|
end
|
9
10
|
|
10
11
|
it "should recognize octal strings" do
|
11
|
-
"012".
|
12
|
+
expect("012").to be_octal
|
12
13
|
end
|
13
14
|
|
14
15
|
it "should recognize upper-case hexadecimal strings" do
|
15
|
-
"2D".
|
16
|
+
expect("2D").to be_uppercase_hex
|
16
17
|
end
|
17
18
|
|
18
19
|
it "should recognize lower-case hexadecimal strings" do
|
19
|
-
"2d".
|
20
|
+
expect("2d").to be_lowercase_hex
|
20
21
|
end
|
21
22
|
|
22
23
|
it "should recognize hexadecimal strings" do
|
23
|
-
"2dE3".
|
24
|
+
expect("2dE3").to be_hex
|
24
25
|
end
|
25
26
|
|
26
27
|
it "should recognize upper-case alpha strings" do
|
27
|
-
"ABC".
|
28
|
+
expect("ABC").to be_uppercase_alpha
|
28
29
|
end
|
29
30
|
|
30
31
|
it "should recognize lower-case alpha strings" do
|
31
|
-
"abc".
|
32
|
+
expect("abc").to be_lowercase_alpha
|
32
33
|
end
|
33
34
|
|
34
35
|
it "should recognize alpha strings" do
|
35
|
-
"abcDEF".
|
36
|
+
expect("abcDEF").to be_alpha
|
36
37
|
end
|
37
38
|
|
38
39
|
it "should recognize alpha-numeric strings" do
|
39
|
-
"abc123".
|
40
|
+
expect("abc123").to be_alpha_numeric
|
40
41
|
end
|
41
42
|
|
42
43
|
it "should recognize punctuation strings" do
|
43
|
-
"[...]".
|
44
|
+
expect("[...]").to be_punctuation
|
44
45
|
end
|
45
46
|
|
46
47
|
it "should recognize symbolic strings" do
|
47
|
-
"++".
|
48
|
+
expect("++").to be_symbolic
|
48
49
|
end
|
49
50
|
|
50
51
|
it "should recognize space strings" do
|
51
|
-
" \t".
|
52
|
+
expect(" \t").to be_space
|
52
53
|
end
|
53
54
|
|
54
55
|
it "should recognize visible strings" do
|
55
|
-
"abc".
|
56
|
-
"ab c".
|
56
|
+
expect("abc").to be_visible
|
57
|
+
expect("ab c").to_not be_visible
|
57
58
|
end
|
58
59
|
|
59
60
|
it "should recognize printable strings" do
|
60
|
-
"abc, [123]\nDEF".
|
61
|
+
expect("abc, [123]\nDEF").to be_printable
|
61
62
|
end
|
62
63
|
|
63
64
|
it "should recognize control strings" do
|
64
|
-
"\b\b\a".
|
65
|
+
expect("\b\b\a").to be_control
|
65
66
|
end
|
66
67
|
|
67
68
|
it "should recognize signed ASCII strings" do
|
68
|
-
"lol\0".
|
69
|
+
expect("lol\0").to be_signed_ascii
|
69
70
|
end
|
70
71
|
|
71
72
|
it "should recognize ASCII strings" do
|
72
|
-
"\xff\xfe".
|
73
|
+
expect("\xff\xfe").to be_ascii
|
73
74
|
end
|
74
75
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,85 +1,52 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: chars
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 2
|
8
|
-
- 0
|
9
|
-
version: 0.2.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.4
|
10
5
|
platform: ruby
|
11
|
-
authors:
|
6
|
+
authors:
|
12
7
|
- Postmodern
|
13
|
-
autorequire:
|
8
|
+
autorequire:
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
requirements:
|
26
|
-
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 0
|
30
|
-
- 2
|
31
|
-
- 0
|
32
|
-
version: 0.2.0
|
11
|
+
date: 2021-10-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
33
20
|
type: :development
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: ore-tasks
|
37
21
|
prerelease: false
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
- 1
|
46
|
-
- 2
|
47
|
-
version: 0.1.2
|
48
|
-
type: :development
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: rspec
|
52
|
-
prerelease: false
|
53
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
-
none: false
|
55
|
-
requirements:
|
56
|
-
- - ~>
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
segments:
|
59
|
-
- 2
|
60
|
-
- 0
|
61
|
-
- 0
|
62
|
-
version: 2.0.0
|
63
|
-
type: :development
|
64
|
-
version_requirements: *id003
|
65
|
-
description: Chars is a Ruby library for working with various character sets, recognizing text and generating random text from specific character sets.
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
description: Chars is a Ruby library for working with various character sets, recognizing
|
28
|
+
text and generating random text from specific character sets.
|
66
29
|
email: postmodern.mod3@gmail.com
|
67
30
|
executables: []
|
68
|
-
|
69
31
|
extensions: []
|
70
|
-
|
71
|
-
extra_rdoc_files:
|
72
|
-
- README.md
|
32
|
+
extra_rdoc_files:
|
73
33
|
- ChangeLog.md
|
74
34
|
- LICENSE.txt
|
75
|
-
|
76
|
-
|
77
|
-
- .
|
78
|
-
- .
|
35
|
+
- README.md
|
36
|
+
files:
|
37
|
+
- ".document"
|
38
|
+
- ".gemspec"
|
39
|
+
- ".github/workflows/ruby.yml"
|
40
|
+
- ".gitignore"
|
41
|
+
- ".rspec"
|
42
|
+
- ".yardopts"
|
79
43
|
- ChangeLog.md
|
44
|
+
- Gemfile
|
80
45
|
- LICENSE.txt
|
81
46
|
- README.md
|
82
47
|
- Rakefile
|
48
|
+
- benchmarks/compare.rb
|
49
|
+
- benchmarks/strings_in.rb
|
83
50
|
- chars.gemspec
|
84
51
|
- gemspec.yml
|
85
52
|
- lib/chars.rb
|
@@ -91,43 +58,34 @@ files:
|
|
91
58
|
- lib/chars/version.rb
|
92
59
|
- spec/char_set_spec.rb
|
93
60
|
- spec/chars_spec.rb
|
94
|
-
- spec/integer_spec.rb
|
61
|
+
- spec/extensions/integer_spec.rb
|
62
|
+
- spec/extensions/string_spec.rb
|
95
63
|
- spec/spec_helper.rb
|
96
|
-
|
97
|
-
|
98
|
-
homepage: http://github.com/postmodern/chars
|
99
|
-
licenses:
|
64
|
+
homepage: https://github.com/postmodern/chars.rb#readme
|
65
|
+
licenses:
|
100
66
|
- MIT
|
101
|
-
|
67
|
+
metadata:
|
68
|
+
documentation_uri: https://rubydoc.info/gems/chars
|
69
|
+
source_code_uri: https://github.com/postmodern/chars.rb
|
70
|
+
bug_tracker_uri: https://github.com/postmodern/chars.rb/issues
|
71
|
+
changelog_uri: https://github.com/postmodern/chars.rb/blob/master/ChangeLog.md
|
72
|
+
post_install_message:
|
102
73
|
rdoc_options: []
|
103
|
-
|
104
|
-
require_paths:
|
74
|
+
require_paths:
|
105
75
|
- lib
|
106
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
-
|
108
|
-
requirements:
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
109
78
|
- - ">="
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
|
-
requirements:
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 2.0.0
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
117
83
|
- - ">="
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
|
120
|
-
- 0
|
121
|
-
version: "0"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
122
86
|
requirements: []
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
signing_key:
|
127
|
-
specification_version: 3
|
87
|
+
rubygems_version: 3.2.22
|
88
|
+
signing_key:
|
89
|
+
specification_version: 4
|
128
90
|
summary: A Ruby library for working with various character sets
|
129
|
-
test_files:
|
130
|
-
- spec/integer_spec.rb
|
131
|
-
- spec/chars_spec.rb
|
132
|
-
- spec/char_set_spec.rb
|
133
|
-
- spec/string_spec.rb
|
91
|
+
test_files: []
|