Sha256: 06e8261bb0d7353c20da291bf33f0003e00c41fb5033d170e9ec8927aeaf5101

Contents?: true

Size: 642 Bytes

Versions: 18

Compression:

Stored size: 642 Bytes

Contents

# Compatibility fixes - to be removed once 1.7 compatibility is no longer required
module FogExtensions
  module Fogdocker
    module Images
      extend ActiveSupport::Concern

      def image_search(query = {})
        Docker::Util.parse_json(Docker.connection.get('/images/search', query)).map do |image|
          downcase_hash_keys(image)
        end
      end

      def downcase_hash_keys(hash, k = [])
        if hash.is_a?(Hash)
          return hash.reduce({}) { |a, e| a.merge! downcase_hash_keys(e[-1], k + [e[0]]) }
        end
        { k.join('_').gsub(/([a-z])([A-Z])/, '\1_\2').downcase => hash }
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
foreman_docker-5.0.0 app/models/concerns/fog_extensions/fogdocker/images.rb
foreman_docker-4.1.1 app/models/concerns/fog_extensions/fogdocker/images.rb
foreman_docker-4.1.0 app/models/concerns/fog_extensions/fogdocker/images.rb
foreman_docker-4.0.0 app/models/concerns/fog_extensions/fogdocker/images.rb
foreman_docker-3.2.1 app/models/concerns/fog_extensions/fogdocker/images.rb
foreman_docker-3.2.0 app/models/concerns/fog_extensions/fogdocker/images.rb
foreman_docker-3.1.0 app/models/concerns/fog_extensions/fogdocker/images.rb
foreman_docker-3.0.0 app/models/concerns/fog_extensions/fogdocker/images.rb
foreman_docker-2.1.1 app/models/concerns/fog_extensions/fogdocker/images.rb
foreman_docker-2.1.0 app/models/concerns/fog_extensions/fogdocker/images.rb
foreman_docker-2.0.1 app/models/concerns/fog_extensions/fogdocker/images.rb
foreman_docker-2.0.0 app/models/concerns/fog_extensions/fogdocker/images.rb
foreman_docker-1.4.1 app/models/concerns/fog_extensions/fogdocker/images.rb
foreman_docker-1.4.0 app/models/concerns/fog_extensions/fogdocker/images.rb
foreman_docker-1.3.1 app/models/concerns/fog_extensions/fogdocker/images.rb
foreman_docker-1.3.0 app/models/concerns/fog_extensions/fogdocker/images.rb
foreman_docker-1.2.4 app/models/concerns/fog_extensions/fogdocker/images.rb
foreman_docker-1.2.3 app/models/concerns/fog_extensions/fogdocker/images.rb