Class: OoxmlParser::Protection

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/xlsx_parser/workbook/style_sheet/cell_xfs/cell_style/protection.rb

Overview

Class for parsing <protection> tag

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

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

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ Protection

Returns a new instance of Protection.



11
12
13
14
15
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet/cell_xfs/cell_style/protection.rb', line 11

def initialize(parent: nil)
  @locked = true
  @hidden = false
  super
end

Instance Attribute Details

#hiddenTrue, False (readonly)

Returns Specifies if formulas in cell are hidden.

Returns:

  • (True, False)

    Specifies if formulas in cell are hidden



9
10
11
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet/cell_xfs/cell_style/protection.rb', line 9

def hidden
  @hidden
end

#lockedTrue, False (readonly)

Returns Specifies if cell is locked.

Returns:

  • (True, False)

    Specifies if cell is locked



7
8
9
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet/cell_xfs/cell_style/protection.rb', line 7

def locked
  @locked
end

Instance Method Details

#parse(node) ⇒ Sheet

Parse Protection data

Parameters:

  • node (Nokogiri::XML:Element)

    with Protection data

Returns:

  • (Sheet)

    value of Protection



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet/cell_xfs/cell_style/protection.rb', line 20

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'locked'
      @locked = boolean_attribute_value(value)
    when 'hidden'
      @hidden = boolean_attribute_value(value)
    end
  end
  self
end