Class: RabbitMQHttpAuthBackend::App::ResponseFormatter

Inherits:
Service
  • Object
show all
Defined in:
lib/rabbitmq_http_auth_backend/app/response_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Service

call

Constructor Details

#initialize(response) ⇒ ResponseFormatter

Returns a new instance of ResponseFormatter.



8
9
10
# File 'lib/rabbitmq_http_auth_backend/app/response_formatter.rb', line 8

def initialize(response)
  @response = response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



6
7
8
# File 'lib/rabbitmq_http_auth_backend/app/response_formatter.rb', line 6

def response
  @response
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/rabbitmq_http_auth_backend/app/response_formatter.rb', line 12

def call
  action = response[0]
  tags = response[1]

  if action == :allow && tags
    "#{action} #{tags.join(' ')}"
  else
    action.to_s
  end
end