Method: Cuid.generate
- Defined in:
- lib/cuid.rb
.generate ⇒ String .generate(quantity) ⇒ Array<String> .generate(quantity, secure_random) ⇒ Array<String>
Returns one or more hashes based on the parameter supplied
79 80 81 82 83 84 85 86 |
# File 'lib/cuid.rb', line 79 def generate(quantity=1,secure_random=false) @use_secure_random = secure_random @fingerprint = get_fingerprint # only need to get the fingerprint once because it is constant per-run return api unless quantity > 1 values = Array(1.upto(quantity)) # create an array of the correct size return values.collect { api } # fill array with hashes end |