Class: OpenXml::Docx::Style
- Inherits:
-
Object
- Object
- OpenXml::Docx::Style
- Includes:
- HasAttributes, HasProperties
- Defined in:
- lib/openxml/docx/style.rb
Constant Summary collapse
- VALID_STYLE_TYPES =
%i(character paragraph table)
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 HasProperties
Constructor Details
#initialize(type) ⇒ Style
Returns a new instance of Style.
30 31 32 |
# File 'lib/openxml/docx/style.rb', line 30 def initialize(type) self.type = type end |
Instance Attribute Details
#character ⇒ Object (readonly)
Returns the value of attribute character.
8 9 10 |
# File 'lib/openxml/docx/style.rb', line 8 def character @character end |
#paragraph ⇒ Object (readonly)
Returns the value of attribute paragraph.
8 9 10 |
# File 'lib/openxml/docx/style.rb', line 8 def paragraph @paragraph end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
8 9 10 |
# File 'lib/openxml/docx/style.rb', line 8 def table @table end |
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'lib/openxml/docx/style.rb', line 8 def type @type end |
Instance Method Details
#character_style? ⇒ Boolean
57 58 59 |
# File 'lib/openxml/docx/style.rb', line 57 def character_style? type == :character end |
#name ⇒ Object
43 44 45 |
# File 'lib/openxml/docx/style.rb', line 43 def name "style" end |
#paragraph_style? ⇒ Boolean
53 54 55 |
# File 'lib/openxml/docx/style.rb', line 53 def paragraph_style? type == :paragraph end |
#table_style? ⇒ Boolean
61 62 63 |
# File 'lib/openxml/docx/style.rb', line 61 def table_style? type == :table end |
#tag ⇒ Object
39 40 41 |
# File 'lib/openxml/docx/style.rb', line 39 def tag :style end |
#to_xml(xml) ⇒ Object
47 48 49 50 51 |
# File 'lib/openxml/docx/style.rb', line 47 def to_xml(xml) xml["w"].public_send(tag, xml_attributes) { property_xml(xml) } end |