class ValidatesHost::HostName

Public Class Methods

new(host_name) click to toggle source
# File lib/validates_host/host_name.rb, line 5
def initialize(host_name)
  @host_name = host_name
end

Public Instance Methods

valid?() click to toggle source
# File lib/validates_host/host_name.rb, line 9
def valid?
  return true if @host_name.blank?

  @host_name =~ /^[a-z][a-z0-9-]+$/
end