Class: Nginx::Accel
- Inherits:
-
Object
- Object
- Nginx::Accel
- Defined in:
- lib/shared_infrastructure/nginx/accel.rb
Instance Attribute Summary collapse
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#location_directory ⇒ Object
readonly
Returns the value of attribute location_directory.
Instance Method Summary collapse
- #alias_string(domain_name) ⇒ Object
-
#initialize(location_directory, domain: nil) ⇒ Accel
constructor
A new instance of Accel.
- #location ⇒ Object
- #proxy_set_header(domain_name) ⇒ Object
Constructor Details
#initialize(location_directory, domain: nil) ⇒ Accel
Returns a new instance of Accel.
5 6 7 8 |
# File 'lib/shared_infrastructure/nginx/accel.rb', line 5 def initialize(location_directory, domain: nil) @domain = domain @location_directory = location_directory.chomp("/").reverse.chomp("/").reverse end |
Instance Attribute Details
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
10 11 12 |
# File 'lib/shared_infrastructure/nginx/accel.rb', line 10 def domain @domain end |
#location_directory ⇒ Object (readonly)
Returns the value of attribute location_directory.
10 11 12 |
# File 'lib/shared_infrastructure/nginx/accel.rb', line 10 def location_directory @location_directory end |
Instance Method Details
#alias_string(domain_name) ⇒ Object
12 13 14 |
# File 'lib/shared_infrastructure/nginx/accel.rb', line 12 def alias_string(domain_name) File.join(Nginx.configuration.root_directory(domain ? domain.domain_name : domain_name), location_directory).to_s end |
#location ⇒ Object
16 17 18 |
# File 'lib/shared_infrastructure/nginx/accel.rb', line 16 def location "/#{location_directory}" end |
#proxy_set_header(domain_name) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/shared_infrastructure/nginx/accel.rb', line 20 def proxy_set_header(domain_name) [ " proxy_set_header X-Sendfile-Type X-Accel-Redirect;", " proxy_set_header X-Accel-Mapping #{alias_string(domain_name)}/=#{location}/;" ].join("\n") end |