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