Class: Hostname
- Inherits:
-
Object
- Object
- Hostname
- Defined in:
- lib/hostname.rb
Instance Attribute Summary collapse
-
#hostname ⇒ Object
readonly
Returns the value of attribute hostname.
Instance Method Summary collapse
-
#initialize(hostname, options = {}) ⇒ Hostname
constructor
A new instance of Hostname.
- #reverse ⇒ Object
- #to_s ⇒ Object
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, = {} ) @hostname = hostname if [:base_hostname] @hostname.gsub!([:base_hostname], '') end end |
Instance Attribute Details
#hostname ⇒ Object (readonly)
Returns the value of attribute hostname.
2 3 4 |
# File 'lib/hostname.rb', line 2 def hostname @hostname end |
Instance Method Details
#reverse ⇒ Object
11 12 13 |
# File 'lib/hostname.rb', line 11 def reverse @hostname.split('.').reverse.join('.') end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/hostname.rb', line 15 def to_s @hostname end |