Method: PropCheck::Generators.simple_symbol
- Defined in:
- lib/prop_check/generators.rb
.simple_symbol ⇒ Object
Generates symbols consisting of lowercase letters and potentially underscores.
Shrinks towards shorter symbols and the letter ‘a’.
>> Generators.simple_symbol.sample(5, size: 10, rng: Random.new(42))
=> [:tokh, :gzswkkxudh, :vubxlfbu, :lzvlyq__jp, :oslw]
685 686 687 688 689 690 691 |
# File 'lib/prop_check/generators.rb', line 685 def simple_symbol alphabet = ('a'..'z').to_a alphabet << '_' array(one_of(*alphabet.map(&method(:constant)))) .map(&:join) .map(&:to_sym) end |