instance method
define_proxy_call
Ruby on Rails 5.2.8.1
Since v5.2.8.1 PrivateSignature
define_proxy_call(include_private, mod, name, send, *extra)
Define a method name in mod that dispatches to send using the given extra args. This falls back on define_method and send if the given names cannot be compiled.
Parameters
-
include_privatereq -
modreq -
namereq -
sendreq -
extrarest
Source
# File activemodel/lib/active_model/attribute_methods.rb, line 365
def define_proxy_call(include_private, mod, name, send, *extra)
defn = if NAME_COMPILABLE_REGEXP.match?(name)
"def #{name}(*args)"
else
"define_method(:'#{name}') do |*args|"
end
extra = (extra.map!(&:inspect) << "*args").join(", ".freeze)
target = if CALL_COMPILABLE_REGEXP.match?(send)
"#{"self." unless include_private}#{send}(#{extra})"
else
"send(:'#{send}', #{extra})"
end
mod.module_eval <<-RUBY, __FILE__, __LINE__ + 1
#{defn}
#{target}
end
RUBY
end
Defined in activemodel/lib/active_model/attribute_methods.rb line 365
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::AttributeMethods::ClassMethods