Module: Nuggets::Object::BooleanMixin

Included in:
Object
Defined in:
lib/nuggets/object/boolean_mixin.rb

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) boolean?

call-seq:

object.boolean? => +true+ or +false+

Returns:

  • (Boolean)


36
37
38
# File 'lib/nuggets/object/boolean_mixin.rb', line 36

def boolean?
  is_a?(::TrueClass) || is_a?(::FalseClass)
end

- (Object) negate Also known as: false?

call-seq:

object.negate => +true+ or +false+


44
45
46
# File 'lib/nuggets/object/boolean_mixin.rb', line 44

def negate
  !self
end

- (Object) to_bool Also known as: true?

call-seq:

object.to_bool => +true+ or +false+


54
55
56
# File 'lib/nuggets/object/boolean_mixin.rb', line 54

def to_bool
  !!self
end