Class: Hostname

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hostname, options = {}) ⇒ Hostname

Returns a new instance of Hostname.



4
5
6
7
8
9
# File 'lib/hostname.rb', line 4

def initialize ( hostname, options = {} )
  @hostname = hostname
  if options[:base_hostname]
    @hostname.gsub!(options[:base_hostname], '') 
  end
end

Instance Attribute Details

#hostnameObject (readonly)

Returns the value of attribute hostname.



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

def hostname
  @hostname
end

Instance Method Details

#reverseObject



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

def reverse
  @hostname.split('.').reverse.join('.')
end

#to_sObject



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

def to_s
  @hostname
end