Class: OoxmlParser::FormProperties
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::FormProperties
- Defined in:
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_properties.rb
Overview
Class for parsing ‘formPr` tag
Instance Attribute Summary collapse
-
#border ⇒ BordersProperties
readonly
Border of field.
-
#help_text ⇒ String
readonly
Text of tooltip.
-
#key ⇒ String
readonly
Field key.
-
#required ⇒ True, False
readonly
Specifies if field is required.
-
#shade ⇒ Shade
readonly
Shade of field.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(parent: nil) ⇒ FormProperties
constructor
A new instance of FormProperties.
-
#parse(node) ⇒ FormProperties
Parse FormProperties object.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil) ⇒ FormProperties
Returns a new instance of FormProperties.
17 18 19 20 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_properties.rb', line 17 def initialize(parent: nil) @required = false super end |
Instance Attribute Details
#border ⇒ BordersProperties (readonly)
Returns border of field.
15 16 17 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_properties.rb', line 15 def border @border end |
#help_text ⇒ String (readonly)
Returns text of tooltip.
9 10 11 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_properties.rb', line 9 def help_text @help_text end |
#key ⇒ String (readonly)
Returns field key.
7 8 9 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_properties.rb', line 7 def key @key end |
#required ⇒ True, False (readonly)
Returns specifies if field is required.
11 12 13 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_properties.rb', line 11 def required @required end |
#shade ⇒ Shade (readonly)
Returns shade of field.
13 14 15 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_properties.rb', line 13 def shade @shade end |
Instance Method Details
#parse(node) ⇒ FormProperties
Parse FormProperties object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_properties.rb', line 25 def parse(node) node.attributes.each do |key, value| case key when 'key' @key = value.value when 'helpText' @help_text = value.value when 'required' @required = boolean_attribute_value(value) end end node.xpath('*').each do |node_child| case node_child.name when 'shd' @shade = Shade.new(parent: self).parse(node_child) when 'border' @border = BordersProperties.new(parent: self).parse(node_child) end end self end |