Method: Instance#to_s

Defined in:
lib/cluster/instance.rb

#to_s(format = nil) ⇒ Object


72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/cluster/instance.rb', line 72

def to_s(format = nil)
  case format
  when :long
    svs = if services.empty?
            '(N/S)'
          else
            services.map {|s|
              disabled_services.include?(s) ? "!#{s}" : s
            }.join(',')
          end
    conn = dns
    conn = ip if !conn or conn.empty?
    conn = "(#{private_ip_address})" if !conn or conn.empty?

    nm = friendly_name
    nm = '(N/N)' if !nm or nm.empty?
    "#{nm}\t#{svs}\t#{state}\t#{id}\t#{conn}"
  else
    label or id
  end
end