Sha256: e2bf7d503ab62acfc730f975fb7a42055bde4e05c670c98c57ec3bd1222b30c8

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 KB

Contents

class Evil::Client
  #
  # Lazy container for a [#schema] and [#parent] settings
  # of a [#new] operation to be initialized with its own options,
  # that reload the [#parent] ones.
  #
  class Builder::Operation < Builder
    # Human-readable representation of the handler
    #
    # @example
    #   '#<MyClient.scopes[:users] @version="1.1">.operations[:fetch]'
    #
    # @return [String]
    #
    def to_s
      "#{parent}.operations[:#{schema.name}]"
    end

    # @!method new(options)
    # Builds new operation with options reloading those of its [#parent]
    #
    # @param  [Hash<Symbol, Object>] options ({}) Custom options
    # @return [Evil::Client::Container::Operation]
    #
    def new(**options)
      Container::Operation.new schema, parent.options.merge(options)
    end

    # @!method call(options)
    # Builds and calls operation at once
    #
    # @param  (see #new)
    # @return (see Container::Operation#call)
    #
    def call(**options)
      new(**options).call
    end
    alias_method :[], :call
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
evil-client-3.0.4 lib/evil/client/builder/operation.rb
evil-client-3.0.3 lib/evil/client/builder/operation.rb
evil-client-3.0.2 lib/evil/client/builder/operation.rb
evil-client-3.0.1 lib/evil/client/builder/operation.rb
evil-client-3.0.0 lib/evil/client/builder/operation.rb
evil-client-2.1.1 lib/evil/client/builder/operation.rb
evil-client-2.1.0 lib/evil/client/builder/operation.rb
evil-client-2.0.0 lib/evil/client/builder/operation.rb
evil-client-1.1.0 lib/evil/client/builder/operation.rb
evil-client-1.0.0 lib/evil/client/builder/operation.rb