Class: Evil::Client::Builder::Operation

Inherits:
Evil::Client::Builder show all
Defined in:
lib/evil/client/builder/operation.rb

Overview

Lazy container for a [#schema] and [#parent] settings of a [#new] operation to be initialized with its own options, that reload the [#parent] ones.

Instance Attribute Summary

Attributes inherited from Evil::Client::Builder

#parent, #schema

Instance Method Summary collapse

Methods inherited from Evil::Client::Builder

#inspect, #to_str

Instance Method Details

#call(options) ⇒ Array Also known as: []

Builds and calls operation at once

Parameters:

  • options (Hash<Symbol, Object>)

    ({}) Custom options

Returns:

  • (Array)


35
36
37
# File 'lib/evil/client/builder/operation.rb', line 35

def call(**options)
  new(**options).call
end

#new(options) ⇒ Evil::Client::Container::Operation

Builds new operation with options reloading those of its [#parent]

Parameters:

  • options (Hash<Symbol, Object>)

    ({}) Custom options

Returns:



25
26
27
# File 'lib/evil/client/builder/operation.rb', line 25

def new(**options)
  Container::Operation.new schema, **parent.options.merge(options)
end

#to_sString

Human-readable representation of the handler

Examples:

'#<MyClient.scopes[:users] @version="1.1">.operations[:fetch]'

Returns:

  • (String)


15
16
17
# File 'lib/evil/client/builder/operation.rb', line 15

def to_s
  "#{parent}.operations[:#{schema.name}]"
end