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



40
41
42
43
44
# File 'lib/qbrick/engine.rb', line 40

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

  app_config.host
end

#hostsObject



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

def hosts
  [Socket.gethostname, 'localhost'].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
    result.compact!
    result.uniq!
  end
end

#portObject



52
53
54
55
56
# File 'lib/qbrick/engine.rb', line 52

def port
  return 80 unless app_config.respond_to? :port

  app_config.port
end

#schemeObject



46
47
48
49
50
# File 'lib/qbrick/engine.rb', line 46

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

  app_config.scheme
end