Class: MsHeaderTrail::Configuration
- Inherits:
-
Object
- Object
- MsHeaderTrail::Configuration
- Defined in:
- lib/ms_header_trail/configuration.rb
Overview
Class responsible for configure the process
Instance Attribute Summary collapse
-
#prefix_keyname ⇒ Object
Key to identify the data included into process, default: msht-.
-
#rack_header_response ⇒ Object
If the header should be returned into rack response, default: false.
Instance Method Summary collapse
- #from_store(key) ⇒ Object
- #http_request_prefix_keyname ⇒ Object
- #http_response_prefix_keyname ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #to_store(key) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
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_keyname ⇒ Object
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_response ⇒ Object
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_keyname ⇒ Object
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_keyname ⇒ Object
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 |