lib/dockage/docker/parse.rb in dockage-0.1.2 vs lib/dockage/docker/parse.rb in dockage-0.1.3
- old
+ new
@@ -15,16 +15,15 @@
spaces = char =~ /\s/ ? spaces + 1 : 0
column_width += 1
end
string.map do |container_string|
- container = Hash[keys.map { |k, v| [k, container_string[v[:start]..v[:stop]].strip] }]
- container[:name] = container[:names].to_s
- .split(',')
- .reject{ |v| v.include?('/') }
- .first
- container[:running] = container[:status].downcase
- .include?('up') ? true : false
+ container = Hash[keys.map { |k, v| [k, container_string[v[:start]..v[:stop]].strip] }]
+ container[:names] = container[:names].to_s.split(',')
+ container[:name] = container[:names].reject{ |v| v.include?('/') }.first
+ container[:linked_with] = container[:names].map{ |name| name.split('/')[0] }.compact
+ container[:running] = container[:status].downcase
+ .include?('up') ? true : false
container
end
end
def slice_column_from_string(string, index, column_width)