Class: Vedeu::Boolean Private

Inherits:
Object
  • Object
show all
Defined in:
lib/vedeu/boolean.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Represent a boolean object.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value = nil) ⇒ Vedeu::Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • value (void) (defaults to: nil)


18
19
20
# File 'lib/vedeu/boolean.rb', line 18

def initialize(value = nil)
  @value = value
end

Instance Attribute Details

#valuevoid (readonly, private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.



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

def value
  @value
end

Class Method Details

.coerce(value = nil) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:



12
13
14
# File 'lib/vedeu/boolean.rb', line 12

def self.coerce(value = nil)
  new(value).coerce
end

Instance Method Details

#coerceBoolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:



23
24
25
# File 'lib/vedeu/boolean.rb', line 23

def coerce
  value ? true : false
end

#false?Boolean Also known as: falsy?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether the value should be considered false.

Returns:



31
32
33
# File 'lib/vedeu/boolean.rb', line 31

def false?
  value.nil? || value == false
end

#true?Boolean Also known as: truthy?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether the value should be considered true.

Returns:



40
41
42
# File 'lib/vedeu/boolean.rb', line 40

def true?
  !false?
end