This repository was archived by the owner on Jun 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 213
module ShopifyCli::MethodObject::ClassMethods
Konstantin Tennhard edited this page Feb 1, 2021
·
3 revisions
call(*args, **kwargs)
creates a new instance and invokes call. Any positional argument is forward
to call. Keyword arguments are either forwarded to the inializer or to
call. If the keyword argument matches the name of property, it is forwarded
to the initializer, otherwise to call.
see source
# File lib/shopify-cli/method_object.rb, line 67
def call(*args, **kwargs)
property_names = properties.keys
property_kwargs = kwargs.slice(*property_names)
remaining_kwargs = kwargs.slice(*(kwargs.keys - property_names))
args = remaining_kwargs.any? ? args.push(remaining_kwargs) : args
new(**property_kwargs).call(*args)
endto_proc()
returns a proc that invokes call with all arguments it receives when called
itself.
see source
# File lib/shopify-cli/method_object.rb, line 80
def to_proc
method(:call).to_proc
end