lib/surrealist/value_assigner.rb
# Checks if there is a custom serializer defined for the object and invokes the method
#   on it first only if the serializer has not defined the same method.
#
# @param [Object] instance an instance of a model or a serializer
# @param [Symbol] method the schema key that represents the method to be invoked
#
# @return [Object] the return value of the method
Checks if there is a custom serializer defined for the object and invokes the method
on it first only if the serializer has not defined the same method.
Checks if there is a custom serializer defined for the object and invokes the method on it first only if the serializer has not defined the same method .
def invoke_method(instance, method)
        object = instance.instance_variable_get(:@object)
        instance_method = instance.class.method_defined?(method) ||
                          instance.class.private_method_defined?(method)
        invoke_object = !instance_method && object && object.respond_to?(method, true)
        invoke_object ? object.send(method) : instance.send(method)
      end
def invoke_method ( instance , method ) object = instance . instance_variable_get ( :@object ) instance_method = instance . class . method_defined? ( method ) || instance . class . private_method_defined? ( method ) invoke_object = ! instance_method && object && object . respond_to? ( method , true ) invoke_object ? object . send ( method ) : instance . send ( method ) end
Checks if there is a custom serializer defined for the object and invokes the method
on it first only if the serializer has not defined the same method.
Checks if there is a custom serializer defined for the object and invokes the method on it first only if the serializer has not defined the same method .
the return value of the method
the return value of the method
Object
instance
<not_specific>
method
<not_specific>
<not_specific>
method the schema key that represents the method to be invoked
method the schema key that represents the method to be invoked