Class: OsCtl::Lib::Hostname

Inherits:
Object
  • Object
show all
Defined in:
lib/libosctl/hostname.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fqdn) ⇒ Hostname

Returns a new instance of Hostname.

Parameters:

  • fqdn (String)


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

#domainObject (readonly)

Returns the value of attribute domain.



3
4
5
# File 'lib/libosctl/hostname.rb', line 3

def domain
  @domain
end

#fqdnObject (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

#localObject (readonly)

Returns the value of attribute local.



3
4
5
# File 'lib/libosctl/hostname.rb', line 3

def local
  @local
end