Class: Deltacloud::InstanceAddress
- Inherits:
-
Object
- Object
- Deltacloud::InstanceAddress
- Defined in:
- lib/deltacloud/models/instance_address.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#address_type ⇒ Object
Returns the value of attribute address_type.
-
#port ⇒ Object
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(address, opts = {}) ⇒ InstanceAddress
constructor
A new instance of InstanceAddress.
- #is_hostname? ⇒ Boolean
- #is_ipv4? ⇒ Boolean
- #is_ipv6? ⇒ Boolean
- #is_mac? ⇒ Boolean
- #is_vnc? ⇒ Boolean
- #to_hash(context) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(address, opts = {}) ⇒ InstanceAddress
Returns a new instance of InstanceAddress.
25 26 27 28 29 30 |
# File 'lib/deltacloud/models/instance_address.rb', line 25 def initialize(address, opts={}) self.address = address self.port = opts[:port] if opts[:port] self.address_type = opts[:type] || :ipv4 self end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
21 22 23 |
# File 'lib/deltacloud/models/instance_address.rb', line 21 def address @address end |
#address_type ⇒ Object
Returns the value of attribute address_type.
23 24 25 |
# File 'lib/deltacloud/models/instance_address.rb', line 23 def address_type @address_type end |
#port ⇒ Object
Returns the value of attribute port.
22 23 24 |
# File 'lib/deltacloud/models/instance_address.rb', line 22 def port @port end |
Instance Method Details
#is_hostname? ⇒ Boolean
62 63 64 |
# File 'lib/deltacloud/models/instance_address.rb', line 62 def is_hostname? address_type == :hostname end |
#is_ipv4? ⇒ Boolean
54 55 56 |
# File 'lib/deltacloud/models/instance_address.rb', line 54 def is_ipv4? address_type == :ipv4 end |
#is_ipv6? ⇒ Boolean
58 59 60 |
# File 'lib/deltacloud/models/instance_address.rb', line 58 def is_ipv6? address_type == :ipv6 end |
#is_mac? ⇒ Boolean
50 51 52 |
# File 'lib/deltacloud/models/instance_address.rb', line 50 def is_mac? address_type == :mac end |
#is_vnc? ⇒ Boolean
66 67 68 |
# File 'lib/deltacloud/models/instance_address.rb', line 66 def is_vnc? address_type == :vnc end |
#to_hash(context) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/deltacloud/models/instance_address.rb', line 41 def to_hash(context) r = { :address => address, :type => address_type } r.merge!(:port => port) if !port.nil? r end |
#to_s ⇒ Object
36 37 38 39 |
# File 'lib/deltacloud/models/instance_address.rb', line 36 def to_s return ['VNC', address, port].join(':') if is_vnc? address end |