Class: Vedeu::Boolean Private
- Inherits:
-
Object
- Object
- Vedeu::Boolean
- 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
- #value ⇒ void readonly private private
Class Method Summary collapse
- .coerce(value = nil) ⇒ Boolean private
Instance Method Summary collapse
- #coerce ⇒ Boolean private
-
#false? ⇒ Boolean
(also: #falsy?)
private
Returns a boolean indicating whether the value should be considered false.
- #initialize(value = nil) ⇒ Vedeu::Boolean constructor private
-
#true? ⇒ Boolean
(also: #truthy?)
private
Returns a boolean indicating whether the value should be considered true.
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.
18 19 20 |
# File 'lib/vedeu/boolean.rb', line 18 def initialize(value = nil) @value = value end |
Instance Attribute Details
#value ⇒ void (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.
12 13 14 |
# File 'lib/vedeu/boolean.rb', line 12 def self.coerce(value = nil) new(value).coerce end |
Instance Method Details
#coerce ⇒ 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.
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.
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.
40 41 42 |
# File 'lib/vedeu/boolean.rb', line 40 def true? !false? end |