Class: Evil::Client::Container Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/evil/client/container.rb

Overview

This class is abstract.

Container that carries schema of operation/scope along with its settings and methods to build sub-scope/operation or perform the current operation.

Direct Known Subclasses

Operation, Scope

Defined Under Namespace

Classes: Operation, Scope

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#schemaEvil::Client::Container::ScopeDefinition (readonly)

The schema containing info about sub-scopes and operations of the scope

Returns:

  • (Evil::Client::Container::ScopeDefinition)


16
17
18
# File 'lib/evil/client/container.rb', line 16

def schema
  @schema
end

#settingsEvil::Client::Settings (readonly)

The settings current scope is initialized with



20
21
22
# File 'lib/evil/client/container.rb', line 20

def settings
  @settings
end

Instance Method Details

#clientClass

The client of the [#schema]

Returns:

  • (Class)


24
25
26
# File 'lib/evil/client/container.rb', line 24

def client
  schema.client
end

#loggerLogger?

Current logger

Returns:

  • (Logger, nil)


69
70
71
# File 'lib/evil/client/container.rb', line 69

def logger
  settings.logger
end

#logger=(logger) ⇒ Logger?

(Re)sets current logger

Parameters:

  • logger (Logger, nil)

Returns:

  • (Logger, nil)


61
62
63
# File 'lib/evil/client/container.rb', line 61

def logger=(logger)
  settings.logger = logger
end

#nameString

The name of the current schema

Returns:

  • (String)


30
31
32
# File 'lib/evil/client/container.rb', line 30

def name
  schema.to_s
end

#optionsHash<Symbol, Object>

Options assigned to the [#settings]

These are opts given to the [#initializer], processed (via defaults, coercion, renaming) by a constructor of settings.

Returns:

  • (Hash<Symbol, Object>)


40
41
42
# File 'lib/evil/client/container.rb', line 40

def options
  settings.options
end

#to_sString Also known as: to_str, inspect

The human-friendly representation of the scope instance

Examples:

'#<MyClient.scopes[:users] @version=1>'

Returns:

  • (String)


50
51
52
# File 'lib/evil/client/container.rb', line 50

def to_s
  "#<#{name} #{options.map { |key, val| "@#{key}=#{val}" }.join(', ')}>"
end