def define_attribute(name, type)
      _name = name.gsub(":", "_")

      define_method(_name) do
        var = instance_variables.include?(:@meta) ? :@meta : :@attributes
        instance_variable_get(var).find do |attribute|
          attribute.key == name
        end.tap{|x| return x.value if x}
      end

      define_method("%s=" % _name) do |value|
        var = instance_variables.include?(:@meta) ? :@meta : :@attributes
        instance_variable_get(var).tap do |attributes|
          if elt = __send__(_name)
            attributes.delete(elt)
          end
          attributes << XES.send(type, name, value)
        end
      end
    end
def define_attribute(name, type)
      _name = name.gsub(":", "_")

      define_method(_name) do
        var = instance_variables.include?(:@meta) ? :@meta : :@attributes
        instance_variable_get(var).find do |attribute|
          attribute.key == name
        end.tap{|x| return x.value if x}
      end

      define_method("%s=" % _name) do |value|
        var = instance_variables.include?(:@meta) ? :@meta : :@attributes
        instance_variable_get(var).tap do |attributes|
          if elt = __send__(_name)
            attributes.delete(elt)
          end
          attributes << XES.send(type, name, value)
        end
      end
    end
Define an attribute accessor.

 @param name [String]
   attribute name
 @param type [String]
   attribute type
 @return [void]