Sha256: c1593de90aeee1937cc5c7e1ac9264f8c7613c3e0475859b7cdbdb5facc53a18

Contents?: true

Size: 438 Bytes

Versions: 7

Compression:

Stored size: 438 Bytes

Contents

class Evil::Client
  #
  # Support chaining of calls for nested scopes/operations
  #
  module Chaining
    Names.clean(self) # Remove unnecessary methods from the instance

    private

    def respond_to_missing?(name, *)
      operations[name] || scopes[name]
    end

    def method_missing(name, *args, &block)
      return super unless respond_to_missing? name
      (operations[name] || scopes[name]).call(*args)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
evil-client-3.0.2 lib/evil/client/chaining.rb
evil-client-3.0.1 lib/evil/client/chaining.rb
evil-client-3.0.0 lib/evil/client/chaining.rb
evil-client-2.1.1 lib/evil/client/chaining.rb
evil-client-2.1.0 lib/evil/client/chaining.rb
evil-client-2.0.0 lib/evil/client/chaining.rb
evil-client-1.1.0 lib/evil/client/chaining.rb