Class: Array
Overview
Some extentions to the core Array class
Constant Summary collapse
Class Method Summary collapse
-
.generate(min: 0, max: 30, type: nil) ⇒ Object
Randomly generate an Array.
Instance Method Summary collapse
-
#generate ⇒ Array
Randomly generate an Array from an Array instance, use the values of the array as generators.
Class Method Details
.generate(min: 0, max: 30, type: nil) ⇒ Object
Randomly generate an Array
105 106 107 108 109 110 111 112 113 |
# File 'lib/ext_core.rb', line 105 def self.generate(min: 0, max: 30, type: nil) (0..Faker::Number.between(min, max)).map do if type.nil? DEFAULT_GENERATIVE_TYPES.sample.generate else type.generate end end end |
Instance Method Details
#generate ⇒ Array
Randomly generate an Array from an Array instance, use the values of the array as generators.
121 122 123 |
# File 'lib/ext_core.rb', line 121 def generate map(&:generate) end |