lib/docktor/container.rb in docktor-0.1.0 vs lib/docktor/container.rb in docktor-0.2.0

- old
+ new

@@ -1,23 +1,24 @@ require "virtus" module Docktor class Container - include Virtus.value_object + include Virtus.model - OPTION_ATTRIBUTES = %i(volumes ports links environment) + 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.select { |key, value| (key != :name || key != :image) && !value.nil? && !value.empty? } + attributes = self.attributes.select { |key, value| OPTION_ATTRIBUTES.include?(key) && !value.try(:empty?) } end end end