Class: Symbol
- Defined in:
- lib/propr/random/symbol.rb,
lib/propr/shrink/symbol.rb
Class Method Summary collapse
-
.random(options = {}, m = Propr::Random) ⇒ Object
@note: Beware of memory consumption.
Instance Method Summary collapse
Class Method Details
.random(options = {}, m = Propr::Random) ⇒ Object
@note: Beware of memory consumption. Symbols are never garbage collected, and we’re generating them at random!
5 6 7 8 9 10 11 12 |
# File 'lib/propr/random/symbol.rb', line 5 def random( = {}, m = Propr::Random) min = [:min] || 0 max = [:max] || 10 = Hash[charset: /[a-z_]/] m.bind(String.random()) do |s| m.unit(s.to_sym) end end |
Instance Method Details
#shrink ⇒ Object
2 3 4 |
# File 'lib/propr/shrink/symbol.rb', line 2 def shrink to_s.shrink.map(&:to_sym) end |