class RubyXL::OOXMLContainerObject

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

Public Class Methods

new(params = {}) click to toggle source
Calls superclass method RubyXL::OOXMLObjectInstanceMethods::new
# File lib/rubyXL/objects/ooxml_object.rb, line 368
def initialize(params = {})
  array_content = params.delete(:_)
  super
  array_content.each_with_index { |v, i| self[i] = v } if array_content
end

Protected Class Methods

define_count_attribute() click to toggle source
# File lib/rubyXL/objects/ooxml_object.rb, line 400
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

Public Instance Methods

before_write_xml() click to toggle source
# File lib/rubyXL/objects/ooxml_object.rb, line 389
def before_write_xml
  true
end
inspect() click to toggle source
Calls superclass method
# File lib/rubyXL/objects/ooxml_object.rb, line 393
def inspect
  vars = [ super ]
  vars = self.instance_variables.each { |v| vars << "#{v}=#{instance_variable_get(v).inspect}" }
  "<#{self.class}: #{super} #{vars.join(", ")}>"
end

Protected Instance Methods

get_node_object(child_node_params) click to toggle source
# File lib/rubyXL/objects/ooxml_object.rb, line 374
def get_node_object(child_node_params)
  if child_node_params[:is_array] then self
  else super
  end
end
init_child_nodes(params) click to toggle source
# File lib/rubyXL/objects/ooxml_object.rb, line 381
def init_child_nodes(params)
  obtain_class_variable(:@@ooxml_child_nodes).each_value { |v|
    next if v[:is_array] # Only one collection node allowed per OOXMLContainerObject, and it is contained in itself.
    instance_variable_set("@#{v[:accessor]}", params[v[:accessor]])
  }
end