Method: MethodDisabling::DisabledMethod#execute

Defined in:
lib/method_disabling.rb

#execute(object, *args, &block) ⇒ Object

The replacement for the original method. It will raise a NoMethodError if the method is disabled. Otherwise, it will execute the original method.

Parameters:

  • object (Object)

    The “self” object of the method being called.

  • args (Array)

    The arguments that were passed to the method.

  • block (Proc)

    The block that was passed to the method.

Returns:

  • Whatever the original method returns.



135
136
137
138
139
140
141
# File 'lib/method_disabling.rb', line 135

def execute(object, *args, &block)
  if disabled?
    raise NoMethodError, message
  else
    object.send(aliased_name, *args, &block)
  end
end