Class: OpenXml::Docx::Style
- Inherits:
-
Object
- Object
- OpenXml::Docx::Style
- Includes:
- AttributeBuilder, PropertyBuilder
- Defined in:
- lib/openxml/docx/style.rb
Constant Summary collapse
- VALID_STYLE_TYPES =
%i(character paragraph table)
Constants included from AttributeBuilder
AttributeBuilder::VALID_THEME_COLORS, AttributeBuilder::VALID_TYPES
Instance Attribute Summary collapse
-
#character ⇒ Object
readonly
Returns the value of attribute character.
-
#paragraph ⇒ Object
readonly
Returns the value of attribute paragraph.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #character_style? ⇒ Boolean
-
#initialize(type) ⇒ Style
constructor
A new instance of Style.
- #name ⇒ Object
- #paragraph_style? ⇒ Boolean
- #table_style? ⇒ Boolean
- #tag ⇒ Object
- #to_xml(xml) ⇒ Object
Methods included from PropertyBuilder
Methods included from AttributeBuilder
#attributes, included, #render?
Constructor Details
#initialize(type) ⇒ Style
Returns a new instance of Style.
29 30 31 |
# File 'lib/openxml/docx/style.rb', line 29 def initialize(type) self.type = type end |
Instance Attribute Details
#character ⇒ Object (readonly)
Returns the value of attribute character.
7 8 9 |
# File 'lib/openxml/docx/style.rb', line 7 def character @character end |
#paragraph ⇒ Object (readonly)
Returns the value of attribute paragraph.
7 8 9 |
# File 'lib/openxml/docx/style.rb', line 7 def paragraph @paragraph end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
7 8 9 |
# File 'lib/openxml/docx/style.rb', line 7 def table @table end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/openxml/docx/style.rb', line 7 def type @type end |
Instance Method Details
#character_style? ⇒ Boolean
56 57 58 |
# File 'lib/openxml/docx/style.rb', line 56 def character_style? type == :character end |
#name ⇒ Object
42 43 44 |
# File 'lib/openxml/docx/style.rb', line 42 def name "style" end |
#paragraph_style? ⇒ Boolean
52 53 54 |
# File 'lib/openxml/docx/style.rb', line 52 def paragraph_style? type == :paragraph end |
#table_style? ⇒ Boolean
60 61 62 |
# File 'lib/openxml/docx/style.rb', line 60 def table_style? type == :table end |
#tag ⇒ Object
38 39 40 |
# File 'lib/openxml/docx/style.rb', line 38 def tag :style end |
#to_xml(xml) ⇒ Object
46 47 48 49 50 |
# File 'lib/openxml/docx/style.rb', line 46 def to_xml(xml) xml["w"].public_send(tag, xml_attributes) { property_xml(xml) } end |