Class: Methodist::Service

Inherits:
Pattern
  • Object
show all
Defined in:
lib/methodist/service.rb

Defined Under Namespace

Classes: ResponseError

Constant Summary collapse

CONST_CLIENT =
'CLIENT'

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pattern

#methodistic?

Class Method Details

.client(client_instance) ⇒ Object

Define client for service

Parameters

  • client_instance [Instance of client klass] - Instance of client class. It could be different clients like redis, elastic, internal api etc.


14
15
16
# File 'lib/methodist/service.rb', line 14

def client(client_instance)
  const_set(CONST_CLIENT, client_instance)
end

Instance Method Details

#client ⇒ Object

Instance method use to get defined client



22
23
24
# File 'lib/methodist/service.rb', line 22

def client
  @client ||= self.class.const_get(CONST_CLIENT) #rescue nil
end