Class: ValidatesHost::HostName
- Inherits:
-
Object
- Object
- ValidatesHost::HostName
- Defined in:
- lib/validates_host/host_name.rb
Instance Method Summary collapse
- #host_name ⇒ Object
-
#initialize(host_name) ⇒ HostName
constructor
A new instance of HostName.
- #valid? ⇒ Boolean
Constructor Details
#initialize(host_name) ⇒ HostName
Returns a new instance of HostName.
3 4 5 |
# File 'lib/validates_host/host_name.rb', line 3 def initialize(host_name) @host_name = host_name end |
Instance Method Details
#host_name ⇒ Object
12 13 14 |
# File 'lib/validates_host/host_name.rb', line 12 def host_name @host_name end |
#valid? ⇒ Boolean
7 8 9 10 |
# File 'lib/validates_host/host_name.rb', line 7 def valid? return true if @host_name.blank? @host_name =~ /^[a-z][a-z0-9-]+$/ end |