Class: FalseClass

Inherits:
Object show all
Defined in:
lib/more_ruby/falseclass.rb

Class Method Summary collapse

Class Method Details

.maybe?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/more_ruby/falseclass.rb', line 8

def self.maybe?
    random
end

.randomObject

Yields true 50% of the time, otherwise yields false



4
5
6
# File 'lib/more_ruby/falseclass.rb', line 4

def self.random
    rand(2) % 2 == 0
end