class Hyperkit::Client

LXD client @see Hyperkit::Client::Certificates @see Hyperkit::Client::Containers @see Hyperkit::Client::Images @see Hyperkit::Client::Networks @see Hyperkit::Client::Operations @see Hyperkit::Client::Profiles

Public Class Methods

new(options = {}) click to toggle source

Initialize a new Hyperkit client

@param options [Hash] Any of the attributes listed in {Hyperkit::Configurable}

@example Use a client with default options

client = Hyperkit.client

@example Create a new client and override the api_endpoint

client = Hyperkit::Client.new(api_endpoint: "https://images.linuxcontainers.org:8443")
# File lib/hyperkit/client.rb, line 63
def initialize(options = {})

  # Use options passed in, but fall back to module defaults
  Hyperkit::Configurable.keys.each do |key|

    # Allow user to explicitly override default values by passing 'key: nil'
    next if options.has_key?(key) && options[key].nil?

    if options.has_key?(key)
      value = options[key]
    else
      value = Hyperkit.instance_variable_get(:"@#{key}")
    end

    instance_variable_set(:"@#{key}", value)
  end

end