Method: ConvenientService::Utils::Object::SafeSend#call

Defined in:
lib/convenient_service/utils/object/safe_send.rb

#callObject

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.

Note:

SafeSend is similar to JSON::SafeParse in a sense that it never raises exceptions.

Returns Can be any type.

Returns:

  • (Object)

    Can be any type.

Since:

  • 1.0.0



79
80
81
82
83
84
85
86
87
# File 'lib/convenient_service/utils/object/safe_send.rb', line 79

def call
  return unless object.respond_to?(method, true)

  begin
    object.__send__(method, *args, **kwargs, &block)
  rescue
    nil
  end
end