Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/dsl/monkeypatches.rb

Overview

Enchancement of String class to generate random sample based on the pattern given.

Instance Method Summary collapse

Instance Method Details

#(size: 32, symbols: [*('A'..'Z'), *('а'..'я'), *('0'..'9'), *[' ']*10]) ⇒ String Also known as: any

TODO:

Possible wanna use Faker here

Generates random sample of String.

Examples:

To create the string of length 12, consisting of lowercased latin letters:

s1 = ('a'..'z').to_chars.

Parameters:

  • size (Fixnum) (defaults to: 32)

    the size of the sample to generate.

  • symbols (Array<Char>) (defaults to: [*('A'..'Z'), *('а'..'я'), *('0'..'9'), *[' ']*10])

    the list of characters used to generate the sample.

Returns:

  • (String)

    the string of the given length, consisting of random characters from the given set.

Raises:

See Also:



58
59
60
61
62
63
64
65
66
67
# File 'lib/dsl/monkeypatches.rb', line 58

def