Sha256: 91c3fe5d305a0aac351e68762a2a1e9a4aa2e849489266bbb0793e04ae37d5bc

Contents?: true

Size: 1.14 KB

Versions: 9

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

require_relative 'checkbox/checkbox_state'
module OoxmlParser
  # Class for parsing `checkbox` tag
  class CheckBox < OOXMLDocumentObject
    # @return [True, False] specifies if checkbox is checked
    attr_reader :checked
    # @return [CheckBoxState] options of checked state
    attr_reader :checked_state
    # @return [CheckBoxState] options of unchecked state
    attr_reader :unchecked_state
    # @return [ValuedChild] group key
    attr_reader :group_key

    # Parse CheckBox object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [CheckBox] result of parsing
    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
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ooxml_parser-0.37.1 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb
ooxml_parser-0.37.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb
ooxml_parser-0.36.1 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb
ooxml_parser-0.36.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb
ooxml_parser-0.35.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb
ooxml_parser-0.34.2 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb
ooxml_parser-0.34.1 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb
ooxml_parser-0.34.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb
ooxml_parser-0.33.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/checkbox.rb