Class: Allinone::SiteSelector

Inherits:
Object
  • Object
show all
Defined in:
lib/allinone/site_selector.rb

Instance Method Summary collapse

Constructor Details

#initialize(request_host) ⇒ SiteSelector

Returns a new instance of SiteSelector.



4
5
6
7
8
# File 'lib/allinone/site_selector.rb', line 4

def initialize(request_host)
  @request_host = request_host.downcase
  @@domains_map_last_build_at ||= Time.at(0).to_datetime.utc
  setup_domains_map
end

Instance Method Details

#fetchObject



10
11
12
13
# File 'lib/allinone/site_selector.rb', line 10

def fetch
  site_id = @@domains_map[@request_host]
  Site.where(id: site_id).first
end