Sha256: 71e994f19bb8ef12434e538a29251e52d981c7ab84b97ba7ac6c6aeda57c88b2

Contents?: true

Size: 764 Bytes

Versions: 1

Compression:

Stored size: 764 Bytes

Contents

require 'fog/core/collection'
require 'fog/compute/models/linode/kernel'

module Fog
  module Linode
    class Compute
      class Kernels < Fog::Collection
        model Fog::Linode::Compute::Kernel

        def all
          load kernels
        end

        def get(id)
          new kernels(id).first
        rescue Fog::Linode::Compute::NotFound
          nil
        end

        private
        def kernels(id=nil)
          connection.avail_kernels(id).body['DATA'].map { |kernel| map_kernel kernel }
        end
        
        def map_kernel(kernel)
          kernel = kernel.each_with_object({}) { |(k, v), h| h[k.downcase.to_sym] = v  }
          kernel.merge! :id => kernel[:kernelid], :name => kernel[:label]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-0.8.2 lib/fog/compute/models/linode/kernels.rb