Class: OsCtl::Lib::Hostname
- Inherits:
-
Object
- Object
- OsCtl::Lib::Hostname
- Defined in:
- lib/libosctl/hostname.rb
Instance Attribute Summary collapse
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#fqdn ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute fqdn.
-
#local ⇒ Object
readonly
Returns the value of attribute local.
Instance Method Summary collapse
-
#initialize(fqdn) ⇒ Hostname
constructor
A new instance of Hostname.
Constructor Details
#initialize(fqdn) ⇒ Hostname
Returns a new instance of Hostname.
6 7 8 9 10 11 |
# File 'lib/libosctl/hostname.rb', line 6 def initialize(fqdn) names = fqdn.split('.') @local = names.first @domain = names[1..].join('.') @fqdn = fqdn end |
Instance Attribute Details
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
3 4 5 |
# File 'lib/libosctl/hostname.rb', line 3 def domain @domain end |
#fqdn ⇒ Object (readonly) Also known as: to_s
Returns the value of attribute fqdn.
3 4 5 |
# File 'lib/libosctl/hostname.rb', line 3 def fqdn @fqdn end |
#local ⇒ Object (readonly)
Returns the value of attribute local.
3 4 5 |
# File 'lib/libosctl/hostname.rb', line 3 def local @local end |