lib/brightbox-cli/cloud_ips.rb in brightbox-cli-3.3.0 vs lib/brightbox-cli/cloud_ips.rb in brightbox-cli-4.0.0.rc2

- old
+ new

@@ -25,10 +25,11 @@ def self.format_translators_for_api(translators) translators.split(",").map do |t| incoming, outgoing, protocol = t.split(":") raise "translator #{t} is invalid" if incoming.nil? || outgoing.nil? || protocol.nil? + { :incoming => incoming, :outgoing => outgoing, :protocol => protocol } end end def attributes @@ -42,24 +43,23 @@ o[:port_translators] = translators(o) o end def mapped? - status == 'mapped' + status == "mapped" end def translators(raw_attributes) - if translators = (raw_attributes[:port_translators] || raw_attributes['port_translators']) - translators.map do |t| - [t['incoming'], t['outgoing'], t['protocol']].join(":") - end - else - nil + translators = (raw_attributes[:port_translators] || raw_attributes["port_translators"]) + return unless translators + + translators.map do |t| + [t["incoming"], t["outgoing"], t["protocol"]].join(":") end end def self.default_field_order - [:id, :status, :public_ip, :destination, :reverse_dns, :name] + %i[id status public_ip destination reverse_dns name] end def <=>(other) status <=> other.status end