Class: ReservedSubdomain::Prefix

Inherits:
Object
  • Object
show all
Defined in:
lib/reserved_subdomain/prefix.rb

Defined Under Namespace

Classes: Prefix

Constant Summary collapse

PREFIXES =
%w[
  db
  dc
  dev
  dns
  ftp
  host
  mail
  mx
  ns
  ntp
  server
  smtp
  static
  support
  test
  vpn
  web
  www
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subdomain) ⇒ Prefix

Returns a new instance of Prefix.



26
27
28
# File 'lib/reserved_subdomain/prefix.rb', line 26

def initialize(subdomain)
  @subdomain = subdomain
end

Instance Attribute Details

#subdomainObject (readonly)

Returns the value of attribute subdomain.



24
25
26
# File 'lib/reserved_subdomain/prefix.rb', line 24

def subdomain
  @subdomain
end

Instance Method Details

#reserved?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/reserved_subdomain/prefix.rb', line 30

def reserved?
  PREFIXES.any? { |prefix| Prefix.new(prefix, subdomain).reserved? }
end