Class: OoxmlParser::WorkbookProtection

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/xlsx_parser/workbook/workbook_protection.rb

Overview

Class for parsing <workbookProtection> tag

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

This class inherits a constructor from OoxmlParser::OOXMLDocumentObject

Instance Attribute Details

#lock_structureTrue, False (readonly)

Returns Specifies if workbook structure is protected.

Returns:

  • (True, False)

    Specifies if workbook structure is protected



7
8
9
# File 'lib/ooxml_parser/xlsx_parser/workbook/workbook_protection.rb', line 7

def lock_structure
  @lock_structure
end

#workbook_algorithm_nameString (readonly)

Returns name of hashing algorithm.

Returns:

  • (String)

    name of hashing algorithm



9
10
11
# File 'lib/ooxml_parser/xlsx_parser/workbook/workbook_protection.rb', line 9

def workbook_algorithm_name
  @workbook_algorithm_name
end

#workbook_hash_valueString (readonly)

Returns hash value for the password.

Returns:

  • (String)

    hash value for the password



11
12
13
# File 'lib/ooxml_parser/xlsx_parser/workbook/workbook_protection.rb', line 11

def workbook_hash_value
  @workbook_hash_value
end

#workbook_salt_valueString (readonly)

Returns salt value for the password.

Returns:

  • (String)

    salt value for the password



13
14
15
# File 'lib/ooxml_parser/xlsx_parser/workbook/workbook_protection.rb', line 13

def workbook_salt_value
  @workbook_salt_value
end

#workbook_spin_countInteger (readonly)

Returns number of times the hashing function shall be iteratively run.

Returns:

  • (Integer)

    number of times the hashing function shall be iteratively run



15
16
17
# File 'lib/ooxml_parser/xlsx_parser/workbook/workbook_protection.rb', line 15

def workbook_spin_count
  @workbook_spin_count
end

Instance Method Details

#parse(node) ⇒ Sheet

Parse WorkbookProtection data

Parameters:

  • node (Nokogiri::XML:Element)

    with WorkbookProtection data

Returns:

  • (Sheet)

    value of WorkbookProtection



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ooxml_parser/xlsx_parser/workbook/workbook_protection.rb', line 20

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'lockStructure'
      @lock_structure = attribute_enabled?(value)
    when 'workbookAlgorithmName'
      @workbook_algorithm_name = value.value.to_s
    when 'workbookHashValue'
      @workbook_hash_value = value.value.to_s
    when 'workbookSaltValue'
      @workbook_salt_value = value.value.to_s
    when 'workbookSpinCount'
      @workbook_spin_count = value.value.to_i
    end
  end
  self
end