Class: VGen::CharGen
- Inherits:
-
Object
- Object
- VGen::CharGen
- Defined in:
- lib/v_gen/char_gen.rb
Instance Attribute Summary collapse
-
#char_gen ⇒ Object
readonly
Returns the value of attribute char_gen.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(only: [ "`", "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-", "_", "+", "=", "[", "{", "]", "}", "\\", "|", ";", ":", "'", "\"", "<", ",", ">", ".", "?", "/", " " ] + ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a, except: []) ⇒ CharGen
constructor
A new instance of CharGen.
Constructor Details
#initialize(only: [ "`", "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-", "_", "+", "=", "[", "{", "]", "}", "\\", "|", ";", ":", "'", "\"", "<", ",", ">", ".", "?", "/", " " ] + ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a, except: []) ⇒ CharGen
Returns a new instance of CharGen.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/v_gen/char_gen.rb', line 4 def initialize( only: [ "`", "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-", "_", "+", "=", "[", "{", "]", "}", "\\", "|", ";", ":", "'", "\"", "<", ",", ">", ".", "?", "/", " " ] + ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a, except: [] ) @only, @except = only, except end |
Instance Attribute Details
#char_gen ⇒ Object (readonly)
Returns the value of attribute char_gen.
3 4 5 |
# File 'lib/v_gen/char_gen.rb', line 3 def char_gen @char_gen end |
Instance Method Details
#call ⇒ Object
17 18 19 |
# File 'lib/v_gen/char_gen.rb', line 17 def call() (@only.to_a - @except.to_a).sample end |