bsielski_value_generator 1.3.0 → 1.4.0
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/README.md +31 -0
- data/lib/v_gen/char_gen.rb +21 -0
- data/lib/v_gen/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 958ca2ccb5cc6a613847d93f09ed09b5ea2beb36e6282537424b98c73ccfa490
|
4
|
+
data.tar.gz: 144257df2a09dc36d607dbcbf330cec006ac7f4b92f6363e4b6d9ebb04a97ec6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3248f1617ee3aa44737ad0d2e269fed42d2f20d8402e8da276850fd788c9cf752ca0bd0fd4d1533678e628fda23c2cfa4c095cac373d9304af427139daca2d68
|
7
|
+
data.tar.gz: 27441115ca3819980db454676fe213e8d99d90592722d1831fdc72ee0fa55462cdccc439e2b7ecc3910f06ab271760044b1b26af20726dd966563a4d21e6a374
|
data/README.md
CHANGED
@@ -187,6 +187,37 @@ VGen::TypicalLetterGen.new # => new_generator
|
|
187
187
|
VGen::TypicalLetterGen.new.call # => new_letter
|
188
188
|
```
|
189
189
|
|
190
|
+
### Class VGen::CharGen
|
191
|
+
|
192
|
+
```ruby
|
193
|
+
require "v_gen/char_gen"
|
194
|
+
```
|
195
|
+
|
196
|
+
#### Constructor
|
197
|
+
|
198
|
+
```ruby
|
199
|
+
VGen::CharGen.new # => new_generator
|
200
|
+
```
|
201
|
+
|
202
|
+
Optionally paramaters:
|
203
|
+
|
204
|
+
- **_only:_** - an array (or range) of objects from which one randomly chosen is returned. Default is:
|
205
|
+
```
|
206
|
+
[
|
207
|
+
"`", "~", "!", "@", "#", "$", "%", "^", "&",
|
208
|
+
"*", "(", ")", "-", "_", "+", "=", "[", "{",
|
209
|
+
"]", "}", "\\", "|", ";", ":", "'", "\"", "<",
|
210
|
+
",", ">", ".", "?", "/", " "
|
211
|
+
] + ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
|
212
|
+
```
|
213
|
+
- **_except:_** - an array (or range) that is substracted from **_only:_** array (or range). Default is `[]`.
|
214
|
+
|
215
|
+
#### Call
|
216
|
+
|
217
|
+
```ruby
|
218
|
+
VGen::CharGen.new.call # => new_char
|
219
|
+
```
|
220
|
+
|
190
221
|
### Class VGen::StringGen
|
191
222
|
|
192
223
|
This generator returns random strings.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module VGen
|
2
|
+
class CharGen
|
3
|
+
attr_reader :char_gen
|
4
|
+
def initialize(
|
5
|
+
only: [
|
6
|
+
"`", "~", "!", "@", "#", "$", "%", "^",
|
7
|
+
"&", "*", "(", ")", "-", "_", "+", "=",
|
8
|
+
"[", "{", "]", "}", "\\", "|", ";", ":",
|
9
|
+
"'", "\"", "<", ",", ">", ".", "?", "/",
|
10
|
+
" "
|
11
|
+
] + ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a,
|
12
|
+
except: []
|
13
|
+
)
|
14
|
+
@only, @except = only, except
|
15
|
+
end
|
16
|
+
|
17
|
+
def call()
|
18
|
+
(@only.to_a - @except.to_a).sample
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/v_gen/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bsielski_value_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bartłomiej Sielski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- examples/simple_generators.rb
|
73
73
|
- lib/v_gen.rb
|
74
74
|
- lib/v_gen/array_gen.rb
|
75
|
+
- lib/v_gen/char_gen.rb
|
75
76
|
- lib/v_gen/float_gen.rb
|
76
77
|
- lib/v_gen/hash_gen.rb
|
77
78
|
- lib/v_gen/int_gen.rb
|