Class: ConvenientService::Utils::Bool::ToEnvBool
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Utils::Bool::ToEnvBool
- Defined in:
- lib/convenient_service/utils/bool/to_env_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
29 30 31 |
# File 'lib/convenient_service/utils/bool/to_env_bool.rb', line 29 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
23 24 25 |
# File 'lib/convenient_service/utils/bool/to_env_bool.rb', line 23 def object @object end |
Instance Method Details
#call ⇒ Boolean
36 37 38 39 40 41 |
# File 'lib/convenient_service/utils/bool/to_env_bool.rb', line 36 def call return true if object == "true" return true if object == "1" !!object end |