Class: Qbrick::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/qbrick/engine.rb

Instance Method Summary collapse

Instance Method Details

#app_configObject



27
28
29
# File 'lib/qbrick/engine.rb', line 27

def app_config
  Rails.application.config
end

#hostObject



38
39
40
41
42
# File 'lib/qbrick/engine.rb', line 38

def host
  return hosts.first unless app_config.respond_to? :host

  app_config.host
end

#hostsObject



31
32
33
34
35
36
# File 'lib/qbrick/engine.rb', line 31

def hosts
  [Socket.gethostname].tap do |result|
    result.concat [app_config.hosts].flatten if app_config.respond_to? :hosts
    result.concat [app_config.host].flatten if app_config.respond_to? :host
  end
end

#portObject



50
51
52
53
54
# File 'lib/qbrick/engine.rb', line 50

def port
  return 80 unless app_config.respond_to? :port

  app_config.port
end

#schemeObject



44
45
46
47
48
# File 'lib/qbrick/engine.rb', line 44

def scheme
  return 'http' unless app_config.respond_to? :scheme

  app_config.scheme
end