Module: Axlsx::SerializedAttributes::ClassMethods

Defined in:
lib/axlsx/util/serialized_attributes.rb

Overview

class methods applied to all includers

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#xml_attributesObject (readonly)

a reader for those attributes



23
24
25
# File 'lib/axlsx/util/serialized_attributes.rb', line 23

def xml_attributes
  @xml_attributes
end

#xml_element_attributesObject (readonly)

attr reader for element attributes



39
40
41
# File 'lib/axlsx/util/serialized_attributes.rb', line 39

def xml_element_attributes
  @xml_element_attributes
end

Instance Method Details

#camel_xml_attributesObject



25
26
27
# File 'lib/axlsx/util/serialized_attributes.rb', line 25

def camel_xml_attributes
  @camel_xml_attributes ||= @xml_attributes.map { |attr| Axlsx.camel(attr, false) }
end

#ivar_xml_attributesObject



29
30
31
# File 'lib/axlsx/util/serialized_attributes.rb', line 29

def ivar_xml_attributes
  @ivar_xml_attributes ||= @xml_attributes.map { |attr| :"@#{attr}" }
end

#serializable_attributes(*symbols) ⇒ Object

This is the method to be used in inheriting classes to specify which of the instance values are serializable



16
17
18
19
20
# File 'lib/axlsx/util/serialized_attributes.rb', line 16

def serializable_attributes(*symbols)
  @xml_attributes = symbols
  @camel_xml_attributes = nil
  @ivar_xml_attributes = nil
end

#serializable_element_attributes(*symbols) ⇒ Object

This helper registers the attributes that will be formatted as elements.



34
35
36
# File 'lib/axlsx/util/serialized_attributes.rb', line 34

def serializable_element_attributes(*symbols)
  @xml_element_attributes = symbols
end