Class: Middleman::PreviewServer::ServerHostname::ServerPlainHostname

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/middleman-core/preview_server/server_hostname.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.match?(name) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
25
# File 'lib/middleman-core/preview_server/server_hostname.rb', line 21

def self.match?(name)
  # rubocop:disable Style/CaseEquality
  name != 'localhost' && /^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?\.?$/ === name
  # rubocop:enable Style/CaseEquality
end

Instance Method Details

#to_sObject Also known as: to_browser



17
18
19
# File 'lib/middleman-core/preview_server/server_hostname.rb', line 17

def to_s
  __getobj__.gsub(/\s/, '+') + '.local'
end