lib/bolt/transport/docker/connection.rb
# Converts the JSON encoded STDOUT string from the docker cli into ruby objects
#
# @param stdout_string [String] The string to convert
# @return [Object] Ruby object representation of the JSON string
Converts the JSON encoded STDOUT string from the docker cli into ruby objects
Converts the JSON encoded STDOUT string from the docker cli into ruby objects
def extract_json(stdout_string)
          stdout_string.split("\n")
                       .reject { |str| str.strip.empty? }
                       .map { |str| JSON.parse(str) }
        end
def extract_json ( stdout_string ) stdout_string . split ( "\n" ) . reject { | str | str . strip . empty? } . map { | str | JSON . parse ( str ) } end
Converts the JSON encoded STDOUT string from the docker cli into ruby objects
Converts the JSON encoded STDOUT string from the docker cli into ruby objects
# The output from the docker format command is a JSON string per line. # We can't do a direct convert but this helper method will convert it into # an array of Objects
Ruby object representation of the JSON string
Ruby object representation of the JSON string
Object
stdout_string
The string to convert
The string to convert