module RubyXL::OOXMLObjectClassMethods

def define_attribute(attr_name, attr_type, extra_params = {})

A String attribute named 'errorStyle' will be accessible as +obj.error_style+, valid values are "stop", "warning", "information"
define_attribute(:errorStyle, %w{ stop warning information }, :default => 'stop',)
The value of the element will be accessible as a String by calling +obj.expression+
define_attribute(:_, :string, :accessor => :expression)
An Integer attribute 'uniqueCount' accessible as +obj.unique_count+
define_attribute(:uniqueCount, :int)
A Boolean attribute 'outline' with default value +true+ will be accessible by calling +obj.outline+
define_attribute(:outline, :bool, :default => true)
==== Examples
* +:computed+ - Do not store this attribute on +parse+, but do call the object-provided read accessor on +write_xml+.
* +:required+ - Whether this attribute is required when writing XML. If the value of the attrinute is not explicitly provided, +:default+ is written instead.
* +:default+ - Value this attribute defaults to if not explicitly provided.
* +:accessor+ - Name of the accessor for this attribute to be defined on the object. If not provided, defaults to classidied +attribute_name+.
* +extra_parameters+ - Hash of optional parameters as follows:
* one of +simple_types+ - String, plus the list of acceptable values is saved for future validation (not used yet).
* +:bool+ - Boolean ("1" and "true" convert to +true+, others to +false+)
* +:ref+ - RubyXL::Reference
* +:sqref+ - RubyXL::Sqref
* +:string+ - String (no conversion)
* +:double+ - Float
* +:uint+ - Unsigned Integer
* +:int+ - Integer
* +attribute_type+ - Specifies the conversion type for the attribute when parsing. Available options are:
* Special attibute name '_' (underscore) denotes the value of the element rather than attribute.
* +attribute_name+ - Name of the element attribute as seen in the source XML. Can be either "String" or :Symbol
=== Parameters
Defines an attribute of OOXML object.
def define_attribute(attr_name, attr_type, extra_params = {})
  attrs = obtain_class_variable(:@@ooxml_attributes)
  attr_hash = extra_params.merge({ :attr_type => attr_type })
  attr_hash[:accessor] ||= accessorize(attr_name)
  attrs[attr_name.to_s] = attr_hash
  self.send(:attr_accessor, attr_hash[:accessor]) unless attr_hash[:computed]
end