Class: FalseClass

Inherits:
Object show all
Defined in:
lib/multiarray.rb

Overview

FalseClass is extended with a few methods

See Also:

  • TrueClass

Instance Method Summary collapse

Instance Method Details

#and(other) ⇒ FalseClass

Boolean ‘and’ operation

Parameters:

Returns:

See Also:



324
325
326
327
328
329
330
331
# File 'lib/multiarray.rb', line 324

def and( other )
  unless other.matched?
    self
  else
    x, y = other.coerce self
    x.and y
  end
end

#conditional(a, b) ⇒ Object

Boolean select operation

Parameters:

  • a (Object)

    Object to select if self is neither false nor nil.

  • b (Object)

    Object to select if self is false or nil.

Returns:

See Also:



357
358
359
# File 'lib/multiarray.rb', line 357

def conditional( a, b )
  b.is_a?( Proc ) ? b.call : b
end

#if(&action) ⇒ Object

Conditional operation

Parameters:

  • action (Proc)

    Action to perform if condition is true.

Returns:

  • (Object)

    The return value should be ignored.



366
367
# File 'lib/multiarray.rb', line 366

def if( &action )
end

#if_else(action1, action2) ⇒ Object

Conditional operation

Parameters:

  • action1 (Proc)

    Action to perform if condition is true.

  • action2 (Proc)

    Action to perform if condition is false.

Returns:

  • (Object)

    The return value should be ignored.



375
376
377
# File 'lib/multiarray.rb', line 375

def if_else( action1, action2 )
  action2.call
end

#notFalseClass

Boolean negation

Returns:

See Also:



313
314
315
# File 'lib/multiarray.rb', line 313

def not
  true
end

#or(other) ⇒ FalseClass, TrueClass

Boolean ‘or’ operation

Parameters:

Returns:

See Also:



340
341
342
343
344
345
346
347
# File 'lib/multiarray.rb', line 340

def or( other )
  unless other.matched?
    other
  else
    x, y = other.coerce self
    x.or y
  end
end