Class: ReverseProxy::Application

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/reverse_proxy/application.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logger

#log

Constructor Details

#initialize(proxy) ⇒ Application

Returns a new instance of Application.



5
6
7
# File 'lib/reverse_proxy/application.rb', line 5

def initialize proxy
  @proxy = proxy
end

Instance Attribute Details

#proxyObject (readonly)

Returns the value of attribute proxy.



4
5
6
# File 'lib/reverse_proxy/application.rb', line 4

def proxy
  @proxy
end

Instance Method Details

#assetsObject



15
16
17
# File 'lib/reverse_proxy/application.rb', line 15

def assets
  "/assets"
end

#mime_typesObject



18
19
20
21
22
23
# File 'lib/reverse_proxy/application.rb', line 18

def mime_types
  return unless Object.const_defined? :Mime
  types = {}
  Mime::EXTENSION_LOOKUP.each{|ext,type| types[type.to_s] ||= []; types[type.to_s] << ext }
  types.collect{|name,extensions| [name,extensions.join(" ")]}.to_h
end

#send_assets?Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/reverse_proxy/application.rb', line 11

def send_assets?
  return false unless Object.const_defined?(:Rails)
  return Rails.application.config.assets.compile == false
end

#socketObject



8
9
10
# File 'lib/reverse_proxy/application.rb', line 8

def socket
  proxy.server.socket.unix.to_puma
end