Module: Kernel

Defined in:
lib/chance/core_extensions.rb

Instance Method Summary collapse

Instance Method Details

#maybe(percent = 50.percent, &block) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/chance/core_extensions.rb', line 3

def maybe(percent = 50.percent, &block)
  if block_given?
    percent.chance.of &block
  else
    percent.chance.happens?
  end
end