Module: Goldendocx

Defined in:
lib/goldendocx/units.rb,
lib/goldendocx.rb,
lib/goldendocx/docx.rb,
lib/goldendocx/parts.rb,
lib/goldendocx/charts.rb,
lib/goldendocx/images.rb,
lib/goldendocx/models.rb,
lib/goldendocx/tables.rb,
lib/goldendocx/element.rb,
lib/goldendocx/version.rb,
lib/goldendocx/document.rb,
lib/goldendocx/documents.rb,
lib/goldendocx/parts/app.rb,
lib/goldendocx/components.rb,
lib/goldendocx/parts/core.rb,
lib/goldendocx/tables/row.rb,
lib/goldendocx/parts/media.rb,
lib/goldendocx/tables/cell.rb,
lib/goldendocx/has_children.rb,
lib/goldendocx/images/shape.rb,
lib/goldendocx/charts/series.rb,
lib/goldendocx/configuration.rb,
lib/goldendocx/documents/body.rb,
lib/goldendocx/has_attributes.rb,
lib/goldendocx/images/picture.rb,
lib/goldendocx/components/text.rb,
lib/goldendocx/documents/style.rb,
lib/goldendocx/parts/documents.rb,
lib/goldendocx/charts/reference.rb,
lib/goldendocx/components/chart.rb,
lib/goldendocx/components/image.rb,
lib/goldendocx/components/table.rb,
lib/goldendocx/documents/styles.rb,
lib/goldendocx/has_associations.rb,
lib/goldendocx/parts/properties.rb,
lib/goldendocx/charts/properties.rb,
lib/goldendocx/charts/value_axis.rb,
lib/goldendocx/images/properties.rb,
lib/goldendocx/tables/header_row.rb,
lib/goldendocx/tables/image_cell.rb,
lib/goldendocx/tables/properties.rb,
lib/goldendocx/documents/document.rb,
lib/goldendocx/documents/settings.rb,
lib/goldendocx/tables/header_cell.rb,
lib/goldendocx/xml_serializers/ox.rb,
lib/goldendocx/models/relationship.rb,
lib/goldendocx/parts/content_types.rb,
lib/goldendocx/charts/category_axis.rb,
lib/goldendocx/components/bar_chart.rb,
lib/goldendocx/components/paragraph.rb,
lib/goldendocx/documents/properties.rb,
lib/goldendocx/models/relationships.rb,
lib/goldendocx/components/line_chart.rb,
lib/goldendocx/components/properties.rb,
lib/goldendocx/content_types/default.rb,
lib/goldendocx/content_types/override.rb,
lib/goldendocx/components/column_chart.rb,
lib/goldendocx/documents/latent_styles.rb,
lib/goldendocx/xml_serializers/nokogiri.rb,
lib/goldendocx/components/doughnut_chart.rb,
lib/goldendocx/components/properties/run.rb,
lib/goldendocx/tables/properties/property.rb,
lib/goldendocx/components/properties/inline.rb,
lib/goldendocx/components/properties/drawing.rb,
lib/goldendocx/components/properties/textual.rb,
lib/goldendocx/components/properties/property.rb,
lib/goldendocx/tables/properties/row_property.rb,
lib/goldendocx/charts/properties/axis_property.rb,
lib/goldendocx/charts/properties/hole_property.rb,
lib/goldendocx/images/properties/blip_property.rb,
lib/goldendocx/tables/properties/cell_property.rb,
lib/goldendocx/tables/properties/grid_property.rb,
lib/goldendocx/charts/properties/chart_property.rb,
lib/goldendocx/charts/properties/index_property.rb,
lib/goldendocx/charts/properties/order_property.rb,
lib/goldendocx/charts/properties/point_property.rb,
lib/goldendocx/images/properties/shape_property.rb,
lib/goldendocx/tables/properties/style_property.rb,
lib/goldendocx/tables/properties/width_property.rb,
lib/goldendocx/charts/properties/layout_property.rb,
lib/goldendocx/charts/properties/marker_property.rb,
lib/goldendocx/charts/properties/smooth_property.rb,
lib/goldendocx/charts/properties/symbol_property.rb,
lib/goldendocx/parts/properties/creator_property.rb,
lib/goldendocx/parts/properties/updater_property.rb,
lib/goldendocx/components/properties/run_property.rb,
lib/goldendocx/images/properties/drawing_property.rb,
lib/goldendocx/images/properties/extents_property.rb,
lib/goldendocx/images/properties/stretch_property.rb,
lib/goldendocx/parts/properties/revision_property.rb,
lib/goldendocx/tables/properties/shading_property.rb,
lib/goldendocx/charts/properties/grouping_property.rb,
lib/goldendocx/components/properties/bold_property.rb,
lib/goldendocx/components/properties/font_property.rb,
lib/goldendocx/charts/properties/bar_chart_property.rb,
lib/goldendocx/charts/properties/direction_property.rb,
lib/goldendocx/charts/properties/plot_area_property.rb,
lib/goldendocx/components/properties/align_property.rb,
lib/goldendocx/components/properties/color_property.rb,
lib/goldendocx/components/properties/style_property.rb,
lib/goldendocx/images/properties/transform_property.rb,
lib/goldendocx/parts/properties/created_at_property.rb,
lib/goldendocx/parts/properties/updated_at_property.rb,
lib/goldendocx/tables/properties/grid_span_property.rb,
lib/goldendocx/charts/properties/cross_axis_property.rb,
lib/goldendocx/charts/properties/line_chart_property.rb,
lib/goldendocx/charts/properties/text_value_property.rb,
lib/goldendocx/documents/properties/section_property.rb,
lib/goldendocx/images/properties/image_data_property.rb,
lib/goldendocx/tables/properties/cell_width_property.rb,
lib/goldendocx/tables/properties/header_row_property.rb,
lib/goldendocx/tables/properties/row_height_property.rb,
lib/goldendocx/charts/properties/data_lables_property.rb,
lib/goldendocx/charts/properties/number_list_property.rb,
lib/goldendocx/charts/properties/point_count_property.rb,
lib/goldendocx/charts/properties/series_text_property.rb,
lib/goldendocx/charts/properties/string_list_property.rb,
lib/goldendocx/components/properties/extents_property.rb,
lib/goldendocx/components/properties/graphic_property.rb,
lib/goldendocx/components/properties/padding_property.rb,
lib/goldendocx/tables/properties/grid_column_property.rb,
lib/goldendocx/charts/properties/column_chart_property.rb,
lib/goldendocx/charts/properties/label_hidden_property.rb,
lib/goldendocx/charts/properties/series_value_property.rb,
lib/goldendocx/components/properties/language_property.rb,
lib/goldendocx/documents/properties/page_size_property.rb,
lib/goldendocx/images/properties/picture_fill_property.rb,
lib/goldendocx/documents/properties/style_name_property.rb,
lib/goldendocx/images/properties/picture_shape_property.rb,
lib/goldendocx/charts/properties/doughnut_chart_property.rb,
lib/goldendocx/charts/properties/rounded_corner_property.rb,
lib/goldendocx/components/properties/non_visual_property.rb,
lib/goldendocx/documents/properties/page_margin_property.rb,
lib/goldendocx/images/properties/fill_rectangle_property.rb,
lib/goldendocx/tables/properties/vertical_align_property.rb,
lib/goldendocx/charts/properties/series_category_property.rb,
lib/goldendocx/components/properties/graphic_data_property.rb,
lib/goldendocx/documents/properties/default_style_property.rb,
lib/goldendocx/components/properties/graphic_frame_property.rb,
lib/goldendocx/charts/properties/auto_title_deleted_property.rb,
lib/goldendocx/images/properties/non_visual_drawing_property.rb,
lib/goldendocx/images/properties/non_visual_picture_property.rb,
lib/goldendocx/documents/properties/run_default_style_property.rb,
lib/goldendocx/components/properties/graphic_frame_locks_property.rb,
lib/goldendocx/documents/properties/paragraph_default_style_property.rb

Overview

It is weired because this will generate two parts of XMLs

Defined Under Namespace

Modules: Charts, Components, ContentTypes, Document, Documents, Element, HasAssociations, HasAttributes, HasChildren, Images, Models, Parts, Tables, Units, XmlSerializers Classes: Configuration, Docx

Constant Summary collapse

NAMESPACES =
{
  a: 'http://schemas.openxmlformats.org/drawingml/2006/main',
  a14: 'http://schemas.microsoft.com/office/drawing/2010/main',
  c: 'http://schemas.openxmlformats.org/drawingml/2006/chart',
  c14: 'http://schemas.microsoft.com/office/drawing/2007/8/2/chart',
  cp: 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties',
  cx: 'http://schemas.microsoft.com/office/drawing/2014/chartex',
  cx1: 'http://schemas.microsoft.com/office/drawing/2015/9/8/chartex',
  cx2: 'http://schemas.microsoft.com/office/drawing/2015/10/21/chartex',
  cx3: 'http://schemas.microsoft.com/office/drawing/2016/5/9/chartex',
  cx4: 'http://schemas.microsoft.com/office/drawing/2016/5/10/chartex',
  cx5: 'http://schemas.microsoft.com/office/drawing/2016/5/11/chartex',
  cx6: 'http://schemas.microsoft.com/office/drawing/2016/5/12/chartex',
  cx7: 'http://schemas.microsoft.com/office/drawing/2016/5/13/chartex',
  cx8: 'http://schemas.microsoft.com/office/drawing/2016/5/14/chartex',
  dc: 'http://purl.org/dc/elements/1.1/',
  dcmitype: 'http://purl.org/dc/dcmitype/',
  dcterms: 'http://purl.org/dc/terms/',
  m: 'http://schemas.openxmlformats.org/officeDocument/2006/math',
  mc: 'http://schemas.openxmlformats.org/markup-compatibility/2006',
  mo: 'http://schemas.microsoft.com/office/mac/office/2008/main',
  mv: 'urn:schemas-microsoft-com:mac:vml',
  o: 'urn:schemas-microsoft-com:office:office',
  pic: 'http://schemas.openxmlformats.org/drawingml/2006/picture',
  r: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
  sl: 'http://schemas.openxmlformats.org/schemaLibrary/2006/main',
  v: 'urn:schemas-microsoft-com:vml',
  w: 'http://schemas.openxmlformats.org/wordprocessingml/2006/main',
  w10: 'urn:schemas-microsoft-com:office:word',
  w14: 'http://schemas.microsoft.com/office/word/2010/wordml',
  w15: 'http://schemas.microsoft.com/office/word/2012/wordml',
  w16cid: 'http://schemas.microsoft.com/office/word/2016/wordml/cid',
  w16se: 'http://schemas.microsoft.com/office/word/2015/wordml/symex',
  wne: 'http://schemas.microsoft.com/office/word/2006/wordml',
  wp: 'http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing',
  wp14: 'http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing',
  wpc: 'http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas',
  wpg: 'http://schemas.microsoft.com/office/word/2010/wordprocessingGroup',
  wpi: 'http://schemas.microsoft.com/office/word/2010/wordprocessingInk',
  wps: 'http://schemas.microsoft.com/office/word/2010/wordprocessingShape',
  xsi: 'http://www.w3.org/2001/XMLSchema-instance'
}.freeze
VERSION =
'0.3.0'

Class Method Summary collapse

Class Method Details

.configObject



60
61
62
# File 'lib/goldendocx.rb', line 60

def config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



56
57
58
# File 'lib/goldendocx.rb', line 56

def configure
  yield config
end

.xml_serializerObject



64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/goldendocx.rb', line 64

def xml_serializer
  @xml_serializer ||=
    begin
      case config.xml_serializer
      when :ox then require 'goldendocx/xml_serializers/ox'
      when :nokogiri then require 'goldendocx/xml_serializers/nokogiri'
      else raise StandardError, 'Unsupported XML serializer'
      end

      serializer_class = "Goldendocx::XmlSerializers::#{config.xml_serializer.to_s.capitalize}"
      Kernel.const_get(serializer_class)
    end
end