Class: Methodist::Service
Defined Under Namespace
Classes: ResponseError
Constant Summary collapse
- CONST_CLIENT =
'CLIENT'
Class Method Summary collapse
-
.client(client_instance) ⇒ Object
Define client for service.
Instance Method Summary collapse
-
#client ⇒ Object
Instance method use to get defined client.
Methods inherited from Pattern
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 |