Module: Kernel

Defined in:
lib/whynot.rb

Instance Method Summary collapse

Instance Method Details

#maybe(&block) ⇒ Object



8
9
10
11
12
# File 'lib/whynot.rb', line 8

def maybe(&block)
  if rand(2) == 1
    yield
  end
end

#mehObject

For when we really don’t care



27
28
29
# File 'lib/whynot.rb', line 27

def meh
  rand(2) == 1 ? true : false
end

#mostly(&block) ⇒ Object



14
15
16
17
18
# File 'lib/whynot.rb', line 14

def mostly(&block)
  unless rand(3) == 1
    yield
  end
end

#occasionally(&block) ⇒ Object



19
20
21
22
23
# File 'lib/whynot.rb', line 19

def occasionally(&block)
  if rand(5) == 1
    yield
  end
end