method
generate_method
v6.1.3.1 -
Show latest stable
- Class:
ActiveRecord::Delegation::GeneratedRelationMethods
generate_method(method)public
No documentation available.
# File activerecord/lib/active_record/relation/delegation.rb, line 59
def generate_method(method)
synchronize do
return if method_defined?(method)
if /\A[a-zA-Z_]\w*[!?]?\z/.match?(method) && !DELEGATION_RESERVED_METHOD_NAMES.include?(method.to_s)
definition = RUBY_VERSION >= "2.7" ? "..." : "*args, &block"
module_eval def #{method}(#{definition}) scoping { klass.#{method}(#{definition}) } end, __FILE__, __LINE__ + 1
else
define_method(method) do |*args, &block|
scoping { klass.public_send(method, *args, &block) }
end
ruby2_keywords(method) if respond_to?(:ruby2_keywords, true)
end
end
end