Class: Hyperb::HostConfig
- Inherits:
-
Object
- Object
- Hyperb::HostConfig
- Includes:
- Utils
- Defined in:
- lib/hyperb/containers/host_config.rb
Overview
helper for managing creating proper container host configs
Instance Attribute Summary collapse
-
#binds ⇒ Object
Returns the value of attribute binds.
-
#links ⇒ Object
Returns the value of attribute links.
-
#log_config ⇒ Object
Returns the value of attribute log_config.
-
#network_mode ⇒ Object
Returns the value of attribute network_mode.
-
#port_bindings ⇒ Object
Returns the value of attribute port_bindings.
-
#publish_all_ports ⇒ Object
Returns the value of attribute publish_all_ports.
-
#readonly_rootfs ⇒ Object
Returns the value of attribute readonly_rootfs.
-
#restart_policy ⇒ Object
Returns the value of attribute restart_policy.
-
#volume_driver ⇒ Object
Returns the value of attribute volume_driver.
-
#volumes_from ⇒ Object
Returns the value of attribute volumes_from.
Instance Method Summary collapse
- #attrs ⇒ Object
-
#fmt ⇒ Object
returns a hash containing formated host config data.
-
#initialize(params = {}) ⇒ HostConfig
constructor
A new instance of HostConfig.
Methods included from Utils
#camelize, #check_arguments, #downcase_symbolize, #prepare_json, #underscore
Constructor Details
#initialize(params = {}) ⇒ HostConfig
Returns a new instance of HostConfig.
13 14 15 16 17 18 |
# 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 |
Instance Attribute Details
#binds ⇒ Object
Returns the value of attribute binds.
9 10 11 |
# File 'lib/hyperb/containers/host_config.rb', line 9 def binds @binds end |
#links ⇒ Object
Returns the value of attribute links.
9 10 11 |
# File 'lib/hyperb/containers/host_config.rb', line 9 def links @links end |
#log_config ⇒ Object
Returns the value of attribute log_config.
9 10 11 |
# File 'lib/hyperb/containers/host_config.rb', line 9 def log_config @log_config end |
#network_mode ⇒ Object
Returns the value of attribute network_mode.
9 10 11 |
# File 'lib/hyperb/containers/host_config.rb', line 9 def network_mode @network_mode end |
#port_bindings ⇒ Object
Returns the value of attribute port_bindings.
9 10 11 |
# File 'lib/hyperb/containers/host_config.rb', line 9 def port_bindings @port_bindings end |
#publish_all_ports ⇒ Object
Returns the value of attribute publish_all_ports.
9 10 11 |
# File 'lib/hyperb/containers/host_config.rb', line 9 def publish_all_ports @publish_all_ports end |
#readonly_rootfs ⇒ Object
Returns the value of attribute readonly_rootfs.
9 10 11 |
# File 'lib/hyperb/containers/host_config.rb', line 9 def readonly_rootfs @readonly_rootfs end |
#restart_policy ⇒ Object
Returns the value of attribute restart_policy.
9 10 11 |
# File 'lib/hyperb/containers/host_config.rb', line 9 def restart_policy @restart_policy end |
#volume_driver ⇒ Object
Returns the value of attribute volume_driver.
9 10 11 |
# File 'lib/hyperb/containers/host_config.rb', line 9 def volume_driver @volume_driver end |
#volumes_from ⇒ Object
Returns the value of attribute volumes_from.
9 10 11 |
# File 'lib/hyperb/containers/host_config.rb', line 9 def volumes_from @volumes_from end |
Instance Method Details
#attrs ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# 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 ⇒ Object
returns a hash containing formated host config data
23 24 25 26 27 28 29 |
# File 'lib/hyperb/containers/host_config.rb', line 23 def fmt formated = {} attrs.keys.each do |key| formated[camelize(key)] = attrs[key] end formated end |