Class: OoxmlParser::CheckBox
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::CheckBox
- Defined in:
- lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb
Overview
Class for parsing ‘checkbox` tag
Instance Attribute Summary collapse
-
#checked ⇒ True, False
readonly
Specifies if checkbox is checked.
-
#checked_state ⇒ CheckBoxState
readonly
Options of checked state.
-
#group_key ⇒ ValuedChild
readonly
Group key.
-
#unchecked_state ⇒ CheckBoxState
readonly
Options of unchecked state.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#parse(node) ⇒ CheckBox
Parse CheckBox object.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Attribute Details
#checked ⇒ True, False (readonly)
Returns specifies if checkbox is checked.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb', line 8 def checked @checked end |
#checked_state ⇒ CheckBoxState (readonly)
Returns options of checked state.
10 11 12 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb', line 10 def checked_state @checked_state end |
#group_key ⇒ ValuedChild (readonly)
Returns group key.
14 15 16 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb', line 14 def group_key @group_key end |
#unchecked_state ⇒ CheckBoxState (readonly)
Returns options of unchecked state.
12 13 14 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb', line 12 def unchecked_state @unchecked_state end |
Instance Method Details
#parse(node) ⇒ CheckBox
Parse CheckBox object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb', line 19 def parse(node) node.xpath('*').each do |node_child| case node_child.name when 'checked' @checked = option_enabled?(node_child, 'hidden') when 'checkedState' @checked_state = CheckBoxState.new(parent: self).parse(node_child) when 'uncheckedState' @unchecked_state = CheckBoxState.new(parent: self).parse(node_child) when 'groupKey' @group_key = ValuedChild.new(:string, parent: self).parse(node_child) end end self end |