Module: Trith::Core::Boolean::Predicates

Defined in:
lib/trith/core/boolean.rb

Overview

Boolean predicates.

Instance Method Summary (collapse)

Instance Method Details

- (Object) andp(a, b) Also known as: and?

Parameters:

  • (Object) a
  • (Object) b

Returns:

  • (Object)


58
59
60
# File 'lib/trith/core/boolean.rb', line 58

def andp(a, b)
  a && b
end

- (Boolean) boolp(obj) Also known as: bool?

Parameters:

  • (Object) obj

Returns:



25
26
27
# File 'lib/trith/core/boolean.rb', line 25

def boolp(obj)
  obj.equal?(false) || obj.equal?(true)
end

- (Boolean) falsep(obj) Also known as: false?

Parameters:

  • (Object) obj

Returns:



33
34
35
# File 'lib/trith/core/boolean.rb', line 33

def falsep(obj)
  obj.equal?(false)
end

- (Boolean) nilp(obj) Also known as: nil?

Parameters:

  • (Object, #nil?) obj

Returns:



17
18
19
# File 'lib/trith/core/boolean.rb', line 17

def nilp(obj)
  obj.nil?
end

- (Object) notp(a) Also known as: not?

Parameters:

  • (Object) a

Returns:

  • (Object)


49
50
51
# File 'lib/trith/core/boolean.rb', line 49

def notp(a)
  !a
end

- (Object) orp(a, b) Also known as: or?

Parameters:

  • (Object) a
  • (Object) b

Returns:

  • (Object)


67
68
69
# File 'lib/trith/core/boolean.rb', line 67

def orp(a, b)
  a || b
end

- (Boolean) truep(obj) Also known as: true?

Parameters:

  • (Object) obj

Returns:



41
42
43
# File 'lib/trith/core/boolean.rb', line 41

def truep(obj)
  obj.equal?(true)
end

- (Object) xorp(a, b) Also known as: xor?

Parameters:

  • (Object) a
  • (Object) b

Returns:

  • (Object)


76
77
78
# File 'lib/trith/core/boolean.rb', line 76

def xorp(a, b)
  a ^ b
end