Sha256: b987b57399d76b9e88da38e2e030b109196737afcdd1c011e4ec86492385af09

Contents?: true

Size: 626 Bytes

Versions: 1

Compression:

Stored size: 626 Bytes

Contents

require "virtus"

module Docktor
  class Container
    include Virtus.model

    OPTION_ATTRIBUTES = %i(volumes ports links environment detach)

    values do
      attribute :name, String
      attribute :image, String
      attribute :command, String
      attribute :volumes, Array[String]
      attribute :ports, Array[String]
      attribute :links, Array[String]
      attribute :environment, Hash[String, String]
      attribute :detach, Boolean, default: false
    end

    def options
      attributes = self.attributes.select { |key, value| OPTION_ATTRIBUTES.include?(key) && !value.try(:empty?) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
docktor-0.2.0 lib/docktor/container.rb