Class: RubyXL::OOXMLContainerObject

Inherits:
Array
  • Object
show all
Includes:
OOXMLObjectInstanceMethods
Defined in:
lib/rubyXL/objects/ooxml_object.rb

Overview

Parent class for OOXML container objects (for example, <fonts><font>...</font><font>...</font></fonts> that obscures the top-level container, allowing direct access to the contents as Array.

Instance Attribute Summary

Attributes included from OOXMLObjectInstanceMethods

#local_namespaces

Class Method Summary collapse

Instance Method Summary collapse

Methods included from OOXMLObjectInstanceMethods

#==, included, #index_in_collection, #write_xml

Constructor Details

#initialize(params = {}) ⇒ OOXMLContainerObject

Returns a new instance of OOXMLContainerObject.



384
385
386
387
388
# File 'lib/rubyXL/objects/ooxml_object.rb', line 384

def initialize(params = {})
  array_content = params.delete(:_)
  super
  array_content.each_with_index { |v, i| self[i] = v } if array_content
end

Class Method Details

.define_count_attribute ⇒ Object



414
415
416
417
# File 'lib/rubyXL/objects/ooxml_object.rb', line 414

def define_count_attribute
  # Count will be inherited from Array. so no need to define it explicitly.
  define_attribute(:count, :uint, :required => true, :computed => true)
end

Instance Method Details

#before_write_xml ⇒ Object



405
406
407
# File 'lib/rubyXL/objects/ooxml_object.rb', line 405

def before_write_xml
  true
end

#inspect ⇒ Object



409
410
411
# File 'lib/rubyXL/objects/ooxml_object.rb', line 409

def inspect
  "<#{self.class}: #{super} #{self.instance_variables.collect{ |v| "#{v}=#{instance_variable_get(v).inspect}" }.join(', ')}>"
end