Class: MsHeaderTrail::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/ms_header_trail/configuration.rb

Overview

Class responsible for configure the process

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



12
13
14
# File 'lib/ms_header_trail/configuration.rb', line 12

def initialize
  @prefix_keyname = "msht-"
end

Instance Attribute Details

#prefix_keynameObject

Key to identify the data included into process, default: msht-



7
8
9
# File 'lib/ms_header_trail/configuration.rb', line 7

def prefix_keyname
  @prefix_keyname
end

#rack_header_responseObject

If the header should be returned into rack response, default: false



10
11
12
# File 'lib/ms_header_trail/configuration.rb', line 10

def rack_header_response
  @rack_header_response
end

Instance Method Details

#from_store(key) ⇒ Object



20
21
22
# File 'lib/ms_header_trail/configuration.rb', line 20

def from_store(key)
  key.to_s.gsub(prefix_keyname, "").to_sym
end

#http_request_prefix_keynameObject



24
25
26
# File 'lib/ms_header_trail/configuration.rb', line 24

def http_request_prefix_keyname
  prefix_keyname.gsub("-", "_").upcase
end

#http_response_prefix_keynameObject



28
29
30
# File 'lib/ms_header_trail/configuration.rb', line 28

def http_response_prefix_keyname
  prefix_keyname.to_s.split(/[-_]/).map(&:capitalize).join("-")
end

#to_store(key) ⇒ Object



16
17
18
# File 'lib/ms_header_trail/configuration.rb', line 16

def to_store(key)
  "#{prefix_keyname}#{key}"
end