class CDM::Attribute attr_reader :type, :name, :syncable, :optional, :defaultValueString def initialize(type_key, name, options = {}) defaults = CDM::DEFAULT_ATTRIBUTE_OPTIONS type_defaults = CDM::DATA_TYPES[type_key][:default_options] options = defaults.merge type_defaults.merge options @type = CDM::DATA_TYPES[type_key][:descriptor].to_s @name = name.to_s @syncable = options[:syncable] @optional = options[:optional] @defaultValueString = options[:defaultValueString] end def xml_attributes attrs = { type: type, name: name, syncable: syncable, optional: optional, defaultValueString: defaultValueString } attrs.reject { |k, v| v.nil? } end def xml_attributes_as_string xml_attributes.map { |k, v| "#{k}=\"#{v}\"" }.join(" ") end def to_xml " " end end