Class: OpenXml::Docx::Elements::Element

Inherits:
Object
  • Object
show all
Includes:
AttributeBuilder
Defined in:
lib/openxml/docx/elements/element.rb

Direct Known Subclasses

AbsolutePositionTab, BookFoldPrinting, BookFoldPrintingSheets, BookFoldReversePrinting, Break, CarriageReturn, Container, ContentPart, Control, Dirty, EmbedBold, EmbedBoldItalic, EmbedItalic, EmbedRegular, EmbedSystemFonts, EmbedTrueTypeFonts, EvenAndOddHeaders, Family, FontAlternateName, FontCharacterSet, FontPanoseOne, FontPitch, FontSig, GridColumn, LastRenderedPageBreak, LongDay, LongMonth, LongYear, NonbreakingHyphen, OptionalHyphen, PageNumber, SaveSubsetFonts, ShortDay, ShortMonth, ShortYear, Symbol, Tab, Text, WordProcessingDrawingEffectExtent, WordProcessingDrawingExtent, WordProcessingDrawingObjectNvProperties, WordProcessingDrawingPositionOffset, WordProcessingDrawingSimplePosition, WordProcessingDrawingWrapCoordinate, WordProcessingDrawingWrapNone, WordProcessingDrawingWrapSquare, WordProcessingDrawingWrapTopAndBottom, OpenXml::DrawingML::Elements::ChildrenExtents, OpenXml::DrawingML::Elements::ChildrenOffset, OpenXml::DrawingML::Elements::Extension, OpenXml::DrawingML::Elements::Extents, OpenXml::DrawingML::Elements::FillRectangle, OpenXml::DrawingML::Elements::GraphicFrameLocks, OpenXml::DrawingML::Elements::HeadEnd, OpenXml::DrawingML::Elements::NoAutofit, OpenXml::DrawingML::Elements::NoFill, OpenXml::DrawingML::Elements::NonVisualDrawingProperties, OpenXml::DrawingML::Elements::Offset, OpenXml::DrawingML::Elements::PictureLocks, OpenXml::DrawingML::Elements::Round, OpenXml::DrawingML::Elements::SRGBColor, OpenXml::DrawingML::Elements::ShapeGuide, OpenXml::DrawingML::Elements::SourceRectangle, OpenXml::DrawingML::Elements::TailEnd

Constant Summary

Constants included from AttributeBuilder

AttributeBuilder::VALID_THEME_COLORS, AttributeBuilder::VALID_TYPES

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AttributeBuilder

#attributes, included, #render?

Class Attribute Details

.namespace(*args) ⇒ Object (readonly)

Returns the value of attribute namespace.



9
10
11
# File 'lib/openxml/docx/elements/element.rb', line 9

def namespace
  @namespace
end

.property_nameObject (readonly)

Returns the value of attribute property_name.



8
9
10
# File 'lib/openxml/docx/elements/element.rb', line 8

def property_name
  @property_name
end

Class Method Details

.name(*args) ⇒ Object



16
17
18
19
# File 'lib/openxml/docx/elements/element.rb', line 16

def name(*args)
  @property_name = args.first if args.any?
  @name
end

.tag(*args) ⇒ Object



11
12
13
14
# File 'lib/openxml/docx/elements/element.rb', line 11

def tag(*args)
  @tag = args.first if args.any?
  @tag
end

Instance Method Details

#nameObject



32
33
34
# File 'lib/openxml/docx/elements/element.rb', line 32

def name
  self.class.property_name || default_name
end

#namespaceObject



36
37
38
# File 'lib/openxml/docx/elements/element.rb', line 36

def namespace
  self.class.namespace || default_namespace
end

#tagObject



28
29
30
# File 'lib/openxml/docx/elements/element.rb', line 28

def tag
  self.class.tag || default_tag
end

#to_xml(xml) ⇒ Object



40
41
42
# File 'lib/openxml/docx/elements/element.rb', line 40

def to_xml(xml)
  xml[namespace].public_send(tag, xml_attributes)
end