Method: Faker::Types.random_complex_type
- Defined in:
- lib/faker/default/types.rb
.random_complex_type ⇒ String, Integer
Produces a random complex type that’s either a String, an Integer, an array or a hash.
137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/faker/default/types.rb', line 137 def random_complex_type types = SIMPLE_TYPES + COMPLEX_TYPES type_to_use = types[rand(0..types.length - 1)] case type_to_use when :string rb_string when :fixnum rb_integer when :hash rb_hash when :array rb_array end end |