Class: ValidatesHost::HostName
- Inherits:
-
Object
- Object
- ValidatesHost::HostName
- Defined in:
- lib/validates_host/host_name.rb
Instance Method Summary collapse
-
#initialize(host_name) ⇒ HostName
constructor
A new instance of HostName.
- #valid? ⇒ Boolean
Constructor Details
#initialize(host_name) ⇒ HostName
Returns a new instance of HostName.
5 6 7 |
# File 'lib/validates_host/host_name.rb', line 5 def initialize(host_name) @host_name = host_name end |
Instance Method Details
#valid? ⇒ Boolean
9 10 11 12 13 |
# 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 |