Class: VGen::CharGen

Inherits:
Object
  • Object
show all
Defined in:
lib/v_gen/char_gen.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_genObject (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

#callObject



17
18
19
# File 'lib/v_gen/char_gen.rb', line 17

def call()
  (@only.to_a - @except.to_a).sample
end