chars 0.2.2 → 0.2.3

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a22fd4d88e24c4f378880de5e324ac4acc4ff197c541baa1b840a8852d420afa
4
+ data.tar.gz: ad9c7a38b080490366aaf4142eb642224d551da165ddeedfb4fc1fd0e6bf0728
5
+ SHA512:
6
+ metadata.gz: 5886283079f3bfcf060facf0b0520a51f75066b0301a87750d262e1e4326fad164e541c9580aad1a3f86810430732b2e1933b2ccee26eda6667d0da2aaf2bf00
7
+ data.tar.gz: 0313dcedc0872cc15f84804bdea985bf726040b48d48018084800c8e07f4224267b5802df4da9d68c5ce79ff0239e4af7138db522fa8523647251524d51e6ba1
@@ -0,0 +1,28 @@
1
+ name: CI
2
+
3
+ on: [ push, pull_request ]
4
+
5
+ jobs:
6
+ tests:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby:
12
+ - 2.4
13
+ - 2.5
14
+ - 2.6
15
+ - 2.7
16
+ - 3.0
17
+ - jruby
18
+ name: Ruby ${{ matrix.ruby }}
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ - name: Install dependencies
26
+ run: bundle install --jobs 4 --retry 3
27
+ - name: Run tests
28
+ run: bundle exec rake test
data/.gitignore CHANGED
@@ -1,6 +1,7 @@
1
- doc
2
- pkg
3
- tmp/*
1
+ /Gemfile.lock
2
+ /doc/
3
+ /pkg/
4
+ /vendor/bundle
4
5
  .DS_Store
5
6
  .yardoc
6
7
  *.swp
@@ -1,3 +1,7 @@
1
+ ### 0.2.3 / 2020-12-25
2
+
3
+ * Change {Chars::CharSet} to inherit from `Set`, instead of `SortedSet`.
4
+
1
5
  ### 0.2.2 / 2012-05-28
2
6
 
3
7
  * {Chars::CharSet#initialize} now raises a TypeError when given arguments
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'rake'
7
+ gem 'rubygems-tasks', '~> 0.2'
8
+ gem 'rspec', '~> 3.0'
9
+ gem 'kramdown'
10
+ gem 'yard', '~> 0.9'
11
+ end
data/Rakefile CHANGED
@@ -1,36 +1,12 @@
1
1
  require 'rubygems'
2
- require 'rake'
3
2
 
4
- begin
5
- gem 'rubygems-tasks', '~> 0.1'
6
- require 'rubygems/tasks'
3
+ require 'rubygems/tasks'
4
+ Gem::Tasks.new
7
5
 
8
- Gem::Tasks.new
9
- rescue LoadError => e
10
- warn e.message
11
- warn "Run `gem install rubygems-tasks` to install 'rubygems/tasks'."
12
- end
13
-
14
- begin
15
- gem 'rspec', '~> 2.4'
16
- require 'rspec/core/rake_task'
17
-
18
- RSpec::Core::RakeTask.new
19
- rescue LoadError => e
20
- task :spec do
21
- abort "Please run `gem install rspec` to install RSpec."
22
- end
23
- end
6
+ require 'rspec/core/rake_task'
7
+ RSpec::Core::RakeTask.new
24
8
  task :test => :spec
25
9
  task :default => :spec
26
10
 
27
- begin
28
- gem 'yard', '~> 0.7'
29
- require 'yard'
30
-
31
- YARD::Rake::YardocTask.new
32
- rescue LoadError => e
33
- task :yard do
34
- abort "Please run `gem install yard` to install YARD."
35
- end
36
- end
11
+ require 'yard'
12
+ YARD::Rake::YardocTask.new
@@ -13,6 +13,4 @@ has_yard: true
13
13
  required_ruby_version: ">= 1.8.7"
14
14
 
15
15
  development_dependencies:
16
- rubygems-tasks: ~> 0.1
17
- rspec: ~> 2.4
18
- yard: ~> 0.7
16
+ bundler: ~> 2.0
@@ -1,7 +1,7 @@
1
1
  require 'set'
2
2
 
3
3
  module Chars
4
- class CharSet < SortedSet
4
+ class CharSet < Set
5
5
 
6
6
  #
7
7
  # Creates a new CharSet object.
@@ -120,7 +120,7 @@ module Chars
120
120
  # If no block is given, an enumerator object will be returned.
121
121
  #
122
122
  def each_char
123
- return enum_for(:each_char) unless block_given?
123
+ return enum_for(__method__) unless block_given?
124
124
 
125
125
  each { |byte| yield @chars[byte] }
126
126
  end
@@ -191,7 +191,7 @@ module Chars
191
191
  # If no block is given, an enumerator object will be returned.
192
192
  #
193
193
  def each_random_byte(n,&block)
194
- return enum_for(:each_random_byte,n) unless block_given?
194
+ return enum_for(__method__,n) unless block_given?
195
195
 
196
196
  n.times { yield random_byte }
197
197
  return nil
@@ -213,7 +213,7 @@ module Chars
213
213
  # If no block is given, an enumerator object will be returned.
214
214
  #
215
215
  def each_random_char(n,&block)
216
- return enum_for(:each_random_char,n) unless block_given?
216
+ return enum_for(__method__,n) unless block_given?
217
217
 
218
218
  each_random_byte(n) { |byte| yield @chars[byte] }
219
219
  end
@@ -1,4 +1,4 @@
1
1
  module Chars
2
2
  # chars version
3
- VERSION = '0.2.2'
3
+ VERSION = '0.2.3'
4
4
  end
@@ -2,193 +2,213 @@ require 'spec_helper'
2
2
  require 'chars/chars'
3
3
 
4
4
  describe Chars::CharSet do
5
- before(:all) do
6
- @integer_range = (0x41..0x43)
7
- @string_range = ('A'..'Z')
8
- @integers = @integer_range.to_a
9
- @strings = @string_range.to_a
5
+ let(:integer_range) { (0x41..0x43) }
6
+ let(:string_range) { ('A'..'Z') }
7
+ let(:integers) { integer_range.to_a }
8
+ let(:strings) { string_range.to_a }
10
9
 
11
- @char_set = described_class.new(*@strings)
12
- end
10
+ subject { described_class.new(*strings) }
13
11
 
14
12
  describe "#initialize" do
15
13
  it "may be created with String arguments" do
16
- @chars = described_class.new(*@strings)
14
+ set = described_class.new(*strings)
17
15
 
18
- @strings.all? { |s| @chars.include_char?(s) }.should == true
16
+ expect(strings.all? { |s| set.include_char?(s) }).to be(true)
19
17
  end
20
18
 
21
19
  it "may be created with an Array of Strings" do
22
- @chars = described_class.new(@strings)
20
+ set = described_class.new(strings)
23
21
 
24
- @strings.all? { |s| @chars.include_char?(s) }.should == true
22
+ expect(strings.all? { |s| set.include_char?(s) }).to be(true)
25
23
  end
26
24
 
27
25
  it "may be created with a Range of Strings" do
28
- @chars = described_class.new(@string_range)
26
+ set = described_class.new(string_range)
29
27
 
30
- @strings.all? { |s| @chars.include_char?(s) }.should == true
28
+ expect(strings.all? { |s| set.include_char?(s) }).to be(true)
31
29
  end
32
30
 
33
31
  it "may be created with Integer arguments" do
34
- @chars = described_class.new(*@integers)
32
+ set = described_class.new(*integers)
35
33
 
36
- @integers.all? { |i| @chars.include?(i) }.should == true
34
+ expect(integers.all? { |i| set.include?(i) }).to be(true)
37
35
  end
38
36
 
39
37
  it "may be created with an Array of Integers" do
40
- @chars = described_class.new(@integers)
38
+ set = described_class.new(integers)
41
39
 
42
- @integers.all? { |i| @chars.include?(i) }.should == true
40
+ expect(integers.all? { |i| set.include?(i) }).to be(true)
43
41
  end
44
42
 
45
43
  it "may be created with a Range of Integers" do
46
- @chars = described_class.new(@integer_range)
44
+ set = described_class.new(integer_range)
47
45
 
48
- @integers.all? { |i| @chars.include?(i) }.should == true
46
+ expect(integers.all? { |i| set.include?(i) }).to be(true)
49
47
  end
50
48
  end
51
49
 
52
50
  it "should include Strings" do
53
- @char_set.include_char?('A').should == true
51
+ expect(subject.include_char?('A')).to be(true)
54
52
  end
55
53
 
56
54
  it "should include Integers" do
57
- @char_set.should include(0x41)
55
+ expect(subject).to include(0x41)
58
56
  end
59
57
 
60
58
  it "should be able to select bytes" do
61
- @sub_chars = @char_set.select_bytes { |c| c <= 0x42 }
59
+ sub_set = subject.select_bytes { |c| c <= 0x42 }
62
60
 
63
- @sub_chars.should == [0x41, 0x42]
61
+ expect(sub_set).to be == [0x41, 0x42]
64
62
  end
65
63
 
66
64
  it "should be able to select chars" do
67
- @sub_chars = @char_set.select_chars { |c| c <= 'B' }
65
+ sub_set = subject.select_chars { |c| c <= 'B' }
68
66
 
69
- @sub_chars.should == ['A', 'B']
67
+ expect(sub_set).to be == ['A', 'B']
70
68
  end
71
69
 
72
70
  it "should return a random byte" do
73
- @char_set.should include(@char_set.random_byte)
71
+ expect(subject).to include(subject.random_byte)
74
72
  end
75
73
 
76
74
  it "should return a random char" do
77
- @char_set.include_char?(@char_set.random_char).should == true
75
+ expect(subject.include_char?(subject.random_char)).to be(true)
78
76
  end
79
77
 
80
78
  it "should iterate over n random bytes" do
81
- @char_set.each_random_byte(10).all? { |b|
82
- @char_set.include?(b)
83
- }.should == true
79
+ expect(subject.each_random_byte(10).all? { |b|
80
+ subject.include?(b)
81
+ }).to be(true)
84
82
  end
85
83
 
86
84
  it "should iterate over n random chars" do
87
- @char_set.each_random_char(10).all? { |c|
88
- @char_set.include_char?(c)
89
- }.should == true
85
+ expect(subject.each_random_char(10).all? { |c|
86
+ subject.include_char?(c)
87
+ }).to be(true)
90
88
  end
91
89
 
92
- it "should return a random Array of bytes" do
93
- bytes = @char_set.random_bytes(10)
90
+ describe "#random_bytes" do
91
+ it "should return a random Array of bytes" do
92
+ bytes = subject.random_bytes(10)
94
93
 
95
- bytes.all? { |b| @char_set.include?(b) }.should == true
96
- end
94
+ expect(bytes.all? { |b| subject.include?(b) }).to be(true)
95
+ end
97
96
 
98
- it "should return a random Array of chars" do
99
- chars = @char_set.random_chars(10)
97
+ context "with a range of lengths" do
98
+ it "should return a random Array of bytes with a varying length" do
99
+ bytes = subject.random_bytes(5..10)
100
100
 
101
- chars.all? { |c| @char_set.include_char?(c) }.should == true
101
+ expect(bytes.length).to be_between(5, 10)
102
+ expect(bytes.all? { |b| subject.include?(b) }).to be(true)
103
+ end
104
+ end
102
105
  end
103
106
 
104
- it "should return a random Array of bytes with a varying length" do
105
- bytes = @char_set.random_bytes(5..10)
107
+ describe "#random_chars" do
108
+ it "should return a random Array of chars" do
109
+ chars = subject.random_chars(10)
106
110
 
107
- bytes.length.should be_between(5, 10)
108
- bytes.all? { |b| @char_set.include?(b) }.should == true
109
- end
111
+ expect(chars.all? { |c| subject.include_char?(c) }).to be(true)
112
+ end
110
113
 
111
- it "should return a random Array of chars with a varying length" do
112
- chars = @char_set.random_chars(5..10)
114
+ context "with a range of lengths" do
115
+ it "should return a random Array of chars with a varying length" do
116
+ chars = subject.random_chars(5..10)
113
117
 
114
- chars.length.should be_between(5, 10)
115
- chars.all? { |c| @char_set.include_char?(c) }.should == true
118
+ expect(chars.length).to be_between(5, 10)
119
+ expect(chars.all? { |c| subject.include_char?(c) }).to be(true)
120
+ end
121
+ end
116
122
  end
117
123
 
118
- it "should return a random String of chars" do
119
- string = @char_set.random_string(10)
120
-
121
- string.chars.all? { |b| @char_set.include_char?(b) }.should == true
122
- end
124
+ describe "#random_string" do
125
+ it "should return a random String of chars" do
126
+ string = subject.random_string(10)
127
+
128
+ expect(string.chars.all? { |b| subject.include_char?(b) }).to be(true)
129
+ end
123
130
 
124
- it "should return a random String of chars with a varying length" do
125
- string = @char_set.random_string(5..10)
131
+ context "with a range of lengths" do
132
+ it "should return a random String of chars with a varying length" do
133
+ string = subject.random_string(5..10)
126
134
 
127
- string.length.should be_between(5, 10)
128
- string.chars.all? { |b| @char_set.include_char?(b) }.should == true
135
+ expect(string.length).to be_between(5, 10)
136
+ expect(string.chars.all? { |b| subject.include_char?(b) }).to be(true)
137
+ end
138
+ end
129
139
  end
130
140
 
131
- it "should return a random Array of unique bytes" do
132
- bytes = @char_set.random_distinct_bytes(10)
141
+ describe "#random_distinct_bytes" do
142
+ it "should return a random Array of unique bytes" do
143
+ bytes = subject.random_distinct_bytes(10)
133
144
 
134
- bytes.uniq.should == bytes
135
- bytes.all? { |b| @char_set.include?(b) }.should == true
136
- end
145
+ expect(bytes.uniq).to be == bytes
146
+ expect(bytes.all? { |b| subject.include?(b) }).to be(true)
147
+ end
137
148
 
138
- it "should return a random Array of unique chars" do
139
- chars = @char_set.random_distinct_chars(10)
149
+ context "with a range of lengths" do
150
+ it "should return a random Array of unique bytes with a varying length" do
151
+ bytes = subject.random_distinct_bytes(5..10)
140
152
 
141
- chars.uniq.should == chars
142
- chars.all? { |c| @char_set.include_char?(c) }.should == true
153
+ expect(bytes.uniq).to be == bytes
154
+ expect(bytes.length).to be_between(5, 10)
155
+ expect(bytes.all? { |b| subject.include?(b) }).to be(true)
156
+ end
157
+ end
143
158
  end
144
159
 
145
- it "should return a random Array of unique bytes with a varying length" do
146
- bytes = @char_set.random_distinct_bytes(5..10)
160
+ describe "#random_distinct_chars" do
161
+ it "should return a random Array of unique chars" do
162
+ chars = subject.random_distinct_chars(10)
147
163
 
148
- bytes.uniq.should == bytes
149
- bytes.length.should be_between(5, 10)
150
- bytes.all? { |b| @char_set.include?(b) }.should == true
151
- end
164
+ expect(chars.uniq).to be == chars
165
+ expect(chars.all? { |c| subject.include_char?(c) }).to be(true)
166
+ end
152
167
 
153
- it "should return a random Array of unique chars with a varying length" do
154
- chars = @char_set.random_distinct_chars(5..10)
168
+ context "with a range of lengths" do
169
+ it "should return a random Array of unique chars with a varying length" do
170
+ chars = subject.random_distinct_chars(5..10)
155
171
 
156
- chars.uniq.should == chars
157
- chars.length.should be_between(5, 10)
158
- chars.all? { |c| @char_set.include_char?(c) }.should == true
172
+ expect(chars.uniq).to be == chars
173
+ expect(chars.length).to be_between(5, 10)
174
+ expect(chars.all? { |c| subject.include_char?(c) }).to be(true)
175
+ end
176
+ end
159
177
  end
160
178
 
161
179
  it "should be able to be compared with another set of chars" do
162
- @char_set.should == described_class['A'..'Z']
180
+ expect(subject).to be == described_class['A'..'Z']
163
181
  end
164
182
 
165
183
  it "should be able to be unioned with another set of chars" do
166
- super_set = (@char_set | described_class['D'])
184
+ super_set = (subject | described_class['D'])
167
185
 
168
- super_set.class.should == described_class
169
- super_set.should == described_class['A'..'Z', 'D']
186
+ expect(super_set).to be_kind_of(described_class)
187
+ expect(super_set).to be == described_class['A'..'Z', 'D']
170
188
  end
171
189
 
172
190
  it "should be able to be removed from another set of chars" do
173
- sub_set = (@char_set - described_class['B'])
191
+ sub_set = (subject - described_class['B'])
174
192
 
175
- sub_set.class.should == described_class
176
- sub_set.should be_subset(@char_set)
193
+ expect(sub_set).to be_kind_of(described_class)
194
+ expect(sub_set).to be_subset(subject)
177
195
  end
178
196
 
179
- it "should find one sub-string from a String belonging to the char set" do
180
- @char_set.strings_in("AAAA").should == ["AAAA"]
181
- end
197
+ describe "#strings_in" do
198
+ it "should find one sub-string from a String belonging to the char set" do
199
+ expect(subject.strings_in("AAAA")).to be == ["AAAA"]
200
+ end
182
201
 
183
- it "should find sub-strings from a String belonging to the char set" do
184
- @char_set.strings_in("AAAA!B!CCCCCC").should == [
185
- "AAAA",
186
- "CCCCCC"
187
- ]
202
+ it "should find sub-strings from a String belonging to the char set" do
203
+ expect(subject.strings_in("AAAA!B!CCCCCC")).to be == [
204
+ "AAAA",
205
+ "CCCCCC"
206
+ ]
207
+ end
188
208
  end
189
209
 
190
210
  it "should determine if a String is made up of the characters from the char set" do
191
- @char_set.should === "AABCBAA"
192
- @char_set.should_not === "AA!!EE"
211
+ expect(subject).to be === "AABCBAA"
212
+ expect(subject).to_not be === "AA!!EE"
193
213
  end
194
214
  end
@@ -3,54 +3,54 @@ require 'chars/chars'
3
3
 
4
4
  describe Chars do
5
5
  it "should provide a numeric CharSet" do
6
- Chars::NUMERIC =~ '0123456789'
6
+ expect(described_class::NUMERIC).to be =~ '0123456789'
7
7
  end
8
8
 
9
9
  it "should provide an octal CharSet" do
10
- Chars::OCTAL =~ "01234567"
10
+ expect(described_class::OCTAL).to be =~ "01234567"
11
11
  end
12
12
 
13
13
  it "should provide an upper-case hexadecimal CharSet" do
14
- Chars::UPPERCASE_HEXADECIMAL =~ "0123456789ABCDEF"
14
+ expect(described_class::UPPERCASE_HEXADECIMAL).to be =~ "0123456789ABCDEF"
15
15
  end
16
16
 
17
17
  it "should provide a lower-case hexadecimal CharSet" do
18
- Chars::LOWERCASE_HEXADECIMAL =~ "0123456789abcdef"
18
+ expect(described_class::LOWERCASE_HEXADECIMAL).to be =~ "0123456789abcdef"
19
19
  end
20
20
 
21
21
  it "should provide a hexadecimal CharSet" do
22
- Chars::HEXADECIMAL =~ "0123456789ABCDEFabcdef"
22
+ expect(described_class::HEXADECIMAL).to be =~ "0123456789ABCDEFabcdef"
23
23
  end
24
24
 
25
25
  it "should provide an upper-case alpha CharSet" do
26
- Chars::UPPERCASE_ALPHA =~ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
26
+ expect(described_class::UPPERCASE_ALPHA).to be =~ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
27
27
  end
28
28
 
29
29
  it "should provide a lower-case alpha CharSet" do
30
- Chars::LOWERCASE_ALPHA =~ "abcdefghijklmnopqrstuvwxyz"
30
+ expect(described_class::LOWERCASE_ALPHA).to be =~ "abcdefghijklmnopqrstuvwxyz"
31
31
  end
32
32
 
33
33
  it "should provide an alpha CharSet" do
34
- Chars::ALPHA =~ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
34
+ expect(described_class::ALPHA).to be =~ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
35
35
  end
36
36
 
37
37
  it "should provide an alpha-numeric CharSet" do
38
- Chars::ALPHA_NUMERIC =~ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
38
+ expect(described_class::ALPHA_NUMERIC).to be =~ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
39
39
  end
40
40
 
41
41
  it "should provide a visible CharSet" do
42
- Chars::VISIBLE =~ "!\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
42
+ expect(described_class::VISIBLE).to be =~ "!\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
43
43
  end
44
44
 
45
45
  it "should provide a space CharSet" do
46
- Chars::SPACE =~ "\t\n\v\f\r "
46
+ expect(described_class::SPACE).to be =~ "\t\n\v\f\r "
47
47
  end
48
48
 
49
49
  it "should provide a punctuation CharSet" do
50
- Chars::PUNCTUATION =~ " !\"'(),-.:;?[]`{}~"
50
+ expect(described_class::PUNCTUATION).to be =~ " !\"'(),-.:;?[]`{}~"
51
51
  end
52
52
 
53
53
  it "should provide a symbols CharSet" do
54
- Chars::SYMBOLS =~ " !\"\#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
54
+ expect(described_class::SYMBOLS).to be =~ " !\"\#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
55
55
  end
56
56
  end
@@ -3,71 +3,71 @@ require 'chars/extensions/integer'
3
3
 
4
4
  describe Integer do
5
5
  it "should recognize numeric bytes" do
6
- 0x39.should be_numeric
6
+ expect(0x39).to be_numeric
7
7
  end
8
8
 
9
9
  it "should recognize octal bytes" do
10
- 0x30.should be_octal
10
+ expect(0x30).to be_octal
11
11
  end
12
12
 
13
13
  it "should recognize upper-case hexadecimal bytes" do
14
- 0x44.should be_uppercase_hex
14
+ expect(0x44).to be_uppercase_hex
15
15
  end
16
16
 
17
17
  it "should recognize lower-case hexadecimal bytes" do
18
- 0x61.should be_lowercase_hex
18
+ expect(0x61).to be_lowercase_hex
19
19
  end
20
20
 
21
21
  it "should recognize hexadecimal bytes" do
22
- 0x63.should be_hex
22
+ expect(0x63).to be_hex
23
23
  end
24
24
 
25
25
  it "should recognize upper-case alpha bytes" do
26
- 0x4c.should be_uppercase_alpha
26
+ expect(0x4c).to be_uppercase_alpha
27
27
  end
28
28
 
29
29
  it "should recognize lower-case alpha bytes" do
30
- 0x71.should be_lowercase_alpha
30
+ expect(0x71).to be_lowercase_alpha
31
31
  end
32
32
 
33
33
  it "should recognize alpha bytes" do
34
- 0x7a.should be_alpha
34
+ expect(0x7a).to be_alpha
35
35
  end
36
36
 
37
37
  it "should recognize alpha-numeric bytes" do
38
- 0x69.should be_alpha_numeric
38
+ expect(0x69).to be_alpha_numeric
39
39
  end
40
40
 
41
41
  it "should recognize punctuation bytes" do
42
- 0x60.should be_punctuation
42
+ expect(0x60).to be_punctuation
43
43
  end
44
44
 
45
45
  it "should recognize symbolic bytes" do
46
- 0x26.should be_symbolic
46
+ expect(0x26).to be_symbolic
47
47
  end
48
48
 
49
49
  it "should recognize space bytes" do
50
- 0x20.should be_space
50
+ expect(0x20).to be_space
51
51
  end
52
52
 
53
53
  it "should recognize visible bytes" do
54
- 0x41.should be_visible
55
- 0x20.should_not be_visible
54
+ expect(0x41).to be_visible
55
+ expect(0x20).to_not be_visible
56
56
  end
57
57
 
58
58
  it "should recognize printable bytes" do
59
- 0x3f.should be_printable
59
+ expect(0x3f).to be_printable
60
60
  end
61
61
 
62
62
  it "should recognize control bytes" do
63
- 0x1b.should be_control
63
+ expect(0x1b).to be_control
64
64
  end
65
65
 
66
66
  it "should recognize signed ASCII bytes" do
67
- 0x00.should be_signed_ascii
67
+ expect(0x00).to be_signed_ascii
68
68
  end
69
69
 
70
70
  it "should recognize ASCII bytes" do
71
- 0x80.should be_ascii
71
+ expect(0x80).to be_ascii
72
72
  end
73
73
  end
@@ -1,73 +1,75 @@
1
+ # encoding: US-ASCII
2
+
1
3
  require 'spec_helper'
2
4
  require 'chars/extensions/string'
3
5
 
4
6
  describe String do
5
7
  it "should recognize numeric strings" do
6
- "0987".should be_numeric
8
+ expect("0987").to be_numeric
7
9
  end
8
10
 
9
11
  it "should recognize octal strings" do
10
- "012".should be_octal
12
+ expect("012").to be_octal
11
13
  end
12
14
 
13
15
  it "should recognize upper-case hexadecimal strings" do
14
- "2D".should be_uppercase_hex
16
+ expect("2D").to be_uppercase_hex
15
17
  end
16
18
 
17
19
  it "should recognize lower-case hexadecimal strings" do
18
- "2d".should be_lowercase_hex
20
+ expect("2d").to be_lowercase_hex
19
21
  end
20
22
 
21
23
  it "should recognize hexadecimal strings" do
22
- "2dE3".should be_hex
24
+ expect("2dE3").to be_hex
23
25
  end
24
26
 
25
27
  it "should recognize upper-case alpha strings" do
26
- "ABC".should be_uppercase_alpha
28
+ expect("ABC").to be_uppercase_alpha
27
29
  end
28
30
 
29
31
  it "should recognize lower-case alpha strings" do
30
- "abc".should be_lowercase_alpha
32
+ expect("abc").to be_lowercase_alpha
31
33
  end
32
34
 
33
35
  it "should recognize alpha strings" do
34
- "abcDEF".should be_alpha
36
+ expect("abcDEF").to be_alpha
35
37
  end
36
38
 
37
39
  it "should recognize alpha-numeric strings" do
38
- "abc123".should be_alpha_numeric
40
+ expect("abc123").to be_alpha_numeric
39
41
  end
40
42
 
41
43
  it "should recognize punctuation strings" do
42
- "[...]".should be_punctuation
44
+ expect("[...]").to be_punctuation
43
45
  end
44
46
 
45
47
  it "should recognize symbolic strings" do
46
- "++".should be_symbolic
48
+ expect("++").to be_symbolic
47
49
  end
48
50
 
49
51
  it "should recognize space strings" do
50
- " \t".should be_space
52
+ expect(" \t").to be_space
51
53
  end
52
54
 
53
55
  it "should recognize visible strings" do
54
- "abc".should be_visible
55
- "ab c".should_not be_visible
56
+ expect("abc").to be_visible
57
+ expect("ab c").to_not be_visible
56
58
  end
57
59
 
58
60
  it "should recognize printable strings" do
59
- "abc, [123]\nDEF".should be_printable
61
+ expect("abc, [123]\nDEF").to be_printable
60
62
  end
61
63
 
62
64
  it "should recognize control strings" do
63
- "\b\b\a".should be_control
65
+ expect("\b\b\a").to be_control
64
66
  end
65
67
 
66
68
  it "should recognize signed ASCII strings" do
67
- "lol\0".should be_signed_ascii
69
+ expect("lol\0").to be_signed_ascii
68
70
  end
69
71
 
70
72
  it "should recognize ASCII strings" do
71
- "\xff\xfe".should be_ascii
73
+ expect("\xff\xfe").to be_ascii
72
74
  end
73
75
  end
@@ -1,4 +1,2 @@
1
- gem 'rspec', '~> 2.4'
2
1
  require 'rspec'
3
-
4
2
  require 'chars/version'
metadata CHANGED
@@ -1,64 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chars
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
5
- prerelease:
4
+ version: 0.2.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Postmodern
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-05-28 00:00:00.000000000 Z
11
+ date: 2020-12-26 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: rubygems-tasks
14
+ name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '0.1'
19
+ version: '2.0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '0.1'
30
- - !ruby/object:Gem::Dependency
31
- name: rspec
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ~>
36
- - !ruby/object:Gem::Version
37
- version: '2.4'
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- version: '2.4'
46
- - !ruby/object:Gem::Dependency
47
- name: yard
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ~>
52
- - !ruby/object:Gem::Version
53
- version: '0.7'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- version: '0.7'
26
+ version: '2.0'
62
27
  description: Chars is a Ruby library for working with various character sets, recognizing
63
28
  text and generating random text from specific character sets.
64
29
  email: postmodern.mod3@gmail.com
@@ -69,12 +34,14 @@ extra_rdoc_files:
69
34
  - LICENSE.txt
70
35
  - README.md
71
36
  files:
72
- - .document
73
- - .gemspec
74
- - .gitignore
75
- - .rspec
76
- - .yardopts
37
+ - ".document"
38
+ - ".gemspec"
39
+ - ".github/workflows/ruby.yml"
40
+ - ".gitignore"
41
+ - ".rspec"
42
+ - ".yardopts"
77
43
  - ChangeLog.md
44
+ - Gemfile
78
45
  - LICENSE.txt
79
46
  - README.md
80
47
  - Rakefile
@@ -97,26 +64,24 @@ files:
97
64
  homepage: https://github.com/postmodern/chars#readme
98
65
  licenses:
99
66
  - MIT
67
+ metadata: {}
100
68
  post_install_message:
101
69
  rdoc_options: []
102
70
  require_paths:
103
71
  - lib
104
72
  required_ruby_version: !ruby/object:Gem::Requirement
105
- none: false
106
73
  requirements:
107
- - - ! '>='
74
+ - - ">="
108
75
  - !ruby/object:Gem::Version
109
76
  version: 1.8.7
110
77
  required_rubygems_version: !ruby/object:Gem::Requirement
111
- none: false
112
78
  requirements:
113
- - - ! '>='
79
+ - - ">="
114
80
  - !ruby/object:Gem::Version
115
81
  version: '0'
116
82
  requirements: []
117
- rubyforge_project:
118
- rubygems_version: 1.8.24
83
+ rubygems_version: 3.2.2
119
84
  signing_key:
120
- specification_version: 3
85
+ specification_version: 4
121
86
  summary: A Ruby library for working with various character sets
122
87
  test_files: []