Sha256: 6483a5a8d0edbd70a89405cbc0d4cbca8e2cca90af227378306d4c910e0eef7e
Contents?: true
Size: 1.32 KB
Versions: 4
Compression:
Stored size: 1.32 KB
Contents
# -*- encoding : utf-8 -*- module LoyalAdmin class << self attr_accessor :config def configure yield self.config ||= Config.new end end DEFAULT_SUBDOMAIN = 'admin'.freeze DEFAULT_WHITE_HOSTS = {}.freeze DEFAULT_INFO_CONFIGS = { :title => 'Loyal Admin' }.freeze class Config def info_config @info_config ||= DEFAULT_INFO_CONFIGS end def info_config= info=DEFAULT_INFO_CONFIGS @info_config ||= ( DEFAULT_INFO_CONFIGS.merge(info) ) end def white_hosts= hosts=DEFAULT_WHITE_HOSTS @white_hosts ||= ( DEFAULT_WHITE_HOSTS.merge(hosts) ) end def white_hosts @white_hosts ||= DEFAULT_WHITE_HOSTS end def prepend_view_paths @prepend_view_paths ||= ( self.white_hosts.inject({}) do |result, pair| host, config = pair if config[:view_paths] result[host] = ::LoyalCore::ArrayUtil.init(config[:view_paths]) end result end ) end def subdomain= subdomain=DEFAULT_SUBDOMAIN @subdomain ||= subdomain end def subdomain @subdomain ||= DEFAULT_SUBDOMAIN end # 判断请求是否可以路由到passport中来 def request_routes_constraints?(request) request.subdomain == self.subdomain end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
loyal_admin-0.0.4 | lib/loyal_admin/config.rb |
loyal_admin-0.0.3 | lib/loyal_admin/config.rb |
loyal_admin-0.0.2 | lib/loyal_admin/config.rb |
loyal_admin-0.0.1 | lib/loyal_admin/config.rb |