class Apiphobic::Requests::Subdomain

Attributes

request[RW]

Public Class Methods

new(request) click to toggle source
# File lib/apiphobic/requests/subdomain.rb, line 8
def initialize(request)
  self.request = request
end

Public Instance Methods

subdomain() click to toggle source
# File lib/apiphobic/requests/subdomain.rb, line 12
def subdomain
  @subdomain ||= raw_host[/\A([a-z\-]+)/i, 1]
end

Private Instance Methods

raw_host() click to toggle source
# File lib/apiphobic/requests/subdomain.rb, line 18
def raw_host
  request.fetch('HTTP_HOST', '')
end