module LeftJoins

Constants

HAS_BUILT_IN_LEFT_JOINS_METHOD
IS_RAILS3_FLAG
VERSION

Public Class Methods

patch(target, method, as:) { || ... } click to toggle source
# File lib/left_joins.rb, line 11
def patch(target, method, as:)
  return yield if target.singleton_methods.include?(method)

  target.define_singleton_method(method, &as)
  result = yield
  target.singleton_class.send(:remove_method, method)

  return result
end