Class: ConvenientService::Utils::Bool::ToBool Private

Inherits:
Support::Command show all
Defined in:
lib/convenient_service/utils/bool/to_bool.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.

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:

Since:

  • 1.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Support::Command

[], call

Constructor Details

#initialize(object) ⇒ void

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:

  • object (Object)

    Can be any type.

Since:

  • 1.0.0



29
30
31
# File 'lib/convenient_service/utils/bool/to_bool.rb', line 29

def initialize(object)
  @object = object
end

Instance Attribute Details

#objectObject (readonly)

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.

Since:

  • 1.0.0



23
24
25
# File 'lib/convenient_service/utils/bool/to_bool.rb', line 23

def object
  @object
end

Instance Method Details

#callBoolean

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:

  • (Boolean)

Since:

  • 1.0.0



36
37
38
# File 'lib/convenient_service/utils/bool/to_bool.rb', line 36

def call
  !!object
end