Class: ConvenientService::Utils::Bool::ToBool
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Utils::Bool::ToBool
- Defined in:
- lib/convenient_service/utils/bool/to_bool.rb
Overview
Converts objects to boolean. Implementation is very basic just to serve the need of this library. More comprehensive solution can be found in Rails, wannabe_bool, etc:
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #call ⇒ Boolean
- #initialize(object) ⇒ void constructor
Methods inherited from Support::Command
Constructor Details
#initialize(object) ⇒ void
24 25 26 |
# File 'lib/convenient_service/utils/bool/to_bool.rb', line 24 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
18 19 20 |
# File 'lib/convenient_service/utils/bool/to_bool.rb', line 18 def object @object end |
Instance Method Details
#call ⇒ Boolean
31 32 33 |
# File 'lib/convenient_service/utils/bool/to_bool.rb', line 31 def call !!object end |