class Hyperb::HostConfig

helper for managing creating proper container host configs @see docs.hyper.sh/Reference/API/2016-04-04%20[Ver.%201.23]/Container/create.html

Attributes

binds[RW]
log_config[RW]
network_mode[RW]
port_bindings[RW]
publish_all_ports[RW]
readonly_rootfs[RW]
restart_policy[RW]
volume_driver[RW]
volumes_from[RW]

Public Class Methods

new(params = {}) click to toggle source
# File lib/hyperb/containers/host_config.rb, line 13
def initialize(params = {})
  params.each do |att, value|
    value = downcase_symbolize(value) if value.is_a?(Hash)
    instance_variable_set("@#{underscore(att)}", value)
  end
end

Public Instance Methods

attrs() click to toggle source
# File lib/hyperb/containers/host_config.rb, line 31
def attrs
  {
    binds: binds,
    links: links,
    port_bindings: port_bindings,
    publish_all_ports: publish_all_ports,
    network_mode: network_mode,
    restart_policy: restart_policy,
    volume_driver: volume_driver,
    log_config: log_config,
    readonly_rootfs: readonly_rootfs,
    volumes_from: volumes_from
  }
end
fmt() click to toggle source

returns a hash containing formated host config data

@returns [Hash]

# File lib/hyperb/containers/host_config.rb, line 23
def fmt
  formated = {}
  attrs.each_key do |key|
    formated[camelize(key)] = attrs[key]
  end
  formated
end