Class: HostsFile::Host

Inherits:
Object
  • Object
show all
Defined in:
lib/hosts_file/host.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ip_address, canonical_hostname, aliases = []) ⇒ Host

Returns a new instance of Host.



5
6
7
8
9
# File 'lib/hosts_file/host.rb', line 5

def initialize(ip_address, canonical_hostname, aliases = [])
  @ip_address = ip_address
  @canonical_hostname = canonical_hostname
  @aliases = aliases
end

Instance Attribute Details

#aliasesObject

Returns the value of attribute aliases.



3
4
5
# File 'lib/hosts_file/host.rb', line 3

def aliases
  @aliases
end

#canonical_hostnameObject

Returns the value of attribute canonical_hostname.



3
4
5
# File 'lib/hosts_file/host.rb', line 3

def canonical_hostname
  @canonical_hostname
end

#ip_addressObject

Returns the value of attribute ip_address.



3
4
5
# File 'lib/hosts_file/host.rb', line 3

def ip_address
  @ip_address
end

Instance Method Details

#hostnameObject



15
16
17
# File 'lib/hosts_file/host.rb', line 15

def hostname
  canonical_hostname
end

#ipObject



19
20
21
# File 'lib/hosts_file/host.rb', line 19

def ip
  ip_address
end

#nameObject



11
12
13
# File 'lib/hosts_file/host.rb', line 11

def name
  hostname
end