Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/rantly/shrinks.rb

Overview

String : shrink to “”

Instance Method Summary collapse

Instance Method Details

#retry?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/rantly/shrinks.rb', line 38

def retry?
  false
end

#shrinkObject



29
30
31
32
33
34
35
36
# File 'lib/rantly/shrinks.rb', line 29

def shrink
  shrunk = dup
  unless empty?
    idx = Random.rand(size)
    shrunk[idx] = ''
  end
  shrunk
end

#shrinkable?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/rantly/shrinks.rb', line 42

def shrinkable?
  self != ''
end