Class: Evil::Client::Container::Scope

Inherits:
Evil::Client::Container show all
Includes:
Evil::Client::Chaining
Defined in:
lib/evil/client/container/scope.rb

Overview

Contains schema and settings of some scope along with methods to initialize its sub- and [#operations]

Instance Attribute Summary

Attributes inherited from Evil::Client::Container

#schema, #settings

Instance Method Summary collapse

Methods inherited from Evil::Client::Container

#client, #logger, #logger=, #name, #options, #to_s

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Evil::Client::Chaining

Instance Method Details

#operationsHash<Symbol, Evil::Client::Container::Operation::Builder>

The collection of named operations constructors

Returns:

  • (Hash<Symbol, Evil::Client::Container::Operation::Builder>)


20
21
22
23
24
25
26
# File 'lib/evil/client/container/scope.rb', line 20

def operations
  @operations ||= \
    schema.operations.each_with_object({}) do |(key, sub_schema), obj|
      next unless key
      obj[key] = Builder::Operation.new(sub_schema, settings)
    end
end

#scopesHash<Symbol, Evil::Client::Container::Scope::Builder>

The collection of named sub-scope constructors

Returns:

  • (Hash<Symbol, Evil::Client::Container::Scope::Builder>)


11
12
13
14
15
16
# File 'lib/evil/client/container/scope.rb', line 11

def scopes
  @scopes ||= \
    schema.scopes.each_with_object({}) do |(key, sub_schema), obj|
      obj[key] = Builder::Scope.new(sub_schema, settings)
    end
end