Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

module ShopifyCli::MethodObject::ClassMethods

Kevin O'Sullivan edited this page Jun 28, 2021 · 3 revisions

Instance Methods

call

call(*args, **kwargs, &block) creates a new instance and invokes call. Any positional argument is forward to call. Keyword arguments are either forwarded to the initializer 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, &block)
  properties.keys.yield_self do |properties|
    new(**kwargs.slice(*properties))
      .call(*args, **kwargs.slice(*(kwargs.keys - properties)), &block)
  end
end

to_proc

to_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 78
def to_proc
  method(:call).to_proc
end

Clone this wiki locally