Class: BarkingIguana::Compound::Host
- Inherits:
-
Object
- Object
- BarkingIguana::Compound::Host
- Extended by:
- Forwardable
- Includes:
- Comparable
- Defined in:
- lib/barking_iguana/compound/host.rb
Instance Attribute Summary collapse
-
#inventory_name ⇒ Object
Returns the value of attribute inventory_name.
-
#ip_address ⇒ Object
Returns the value of attribute ip_address.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #assign_ip_address(new_ip_address) ⇒ Object
- #eql?(other) ⇒ Boolean
-
#initialize(name:, ip_address:) ⇒ Host
constructor
A new instance of Host.
- #name ⇒ Object
- #ssh_extra_args ⇒ Object
- #ssh_key ⇒ Object
- #ssh_username ⇒ Object
Constructor Details
#initialize(name:, ip_address:) ⇒ Host
Returns a new instance of Host.
8 9 10 11 12 |
# File 'lib/barking_iguana/compound/host.rb', line 8 def initialize(name:, ip_address:) self.inventory_name = name self.ip_address = ip_address self.state = 'unknown' end |
Instance Attribute Details
#inventory_name ⇒ Object
Returns the value of attribute inventory_name.
6 7 8 |
# File 'lib/barking_iguana/compound/host.rb', line 6 def inventory_name @inventory_name end |
#ip_address ⇒ Object
Returns the value of attribute ip_address.
6 7 8 |
# File 'lib/barking_iguana/compound/host.rb', line 6 def ip_address @ip_address end |
#state ⇒ Object
Returns the value of attribute state.
6 7 8 |
# File 'lib/barking_iguana/compound/host.rb', line 6 def state @state end |
Instance Method Details
#<=>(other) ⇒ Object
18 19 20 |
# File 'lib/barking_iguana/compound/host.rb', line 18 def <=> other name <=> other.name end |
#assign_ip_address(new_ip_address) ⇒ Object
23 24 25 |
# File 'lib/barking_iguana/compound/host.rb', line 23 def assign_ip_address new_ip_address self.ip_address = new_ip_address end |
#eql?(other) ⇒ Boolean
41 42 43 |
# File 'lib/barking_iguana/compound/host.rb', line 41 def eql? other inventory_name == other.inventory_name end |
#name ⇒ Object
14 15 16 |
# File 'lib/barking_iguana/compound/host.rb', line 14 def name @name ||= inventory_name.gsub(/[^a-z0-9\-]/, '-') end |
#ssh_extra_args ⇒ Object
35 36 37 |
# File 'lib/barking_iguana/compound/host.rb', line 35 def ssh_extra_args '-o StrictHostKeyChecking=no' end |
#ssh_key ⇒ Object
27 28 29 |
# File 'lib/barking_iguana/compound/host.rb', line 27 def ssh_key "#{ENV['HOME']}/.vagrant.d/insecure_private_key" end |
#ssh_username ⇒ Object
31 32 33 |
# File 'lib/barking_iguana/compound/host.rb', line 31 def ssh_username 'vagrant' end |