Class: OoxmlParser::DefinedName

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

Overview

Class for parsing <definedName> 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

#hiddenSymbol (readonly)

Returns Specifies whether defined name is hidden.

Returns:

  • (Symbol)

    Specifies whether defined name is hidden



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

def hidden
  @hidden
end

#local_sheet_idString (readonly)

Returns Id of sheet.

Returns:

  • (String)

    Id of sheet



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

def local_sheet_id
  @local_sheet_id
end

#nameString (readonly)

Returns Name.

Returns:

  • (String)

    Name



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

def name
  @name
end

#rangeString (readonly)

Returns Ranges to which defined name refers.

Returns:

  • (String)

    Ranges to which defined name refers



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

def range
  @range
end

Instance Method Details

#parse(node) ⇒ DefinedName

Parse Defined Name data

Parameters:

  • node (Nokogiri::XML:Element)

    with DefinedName data

Returns:



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ooxml_parser/xlsx_parser/workbook/defined_name.rb', line 18

def parse(node)
  @range = node.text
  node.attributes.each do |key, value|
    case key
    when 'name'
      @name = value.value.to_s
    when 'localSheetId'
      @local_sheet_id = value.value.to_i
    when 'hidden'
      @hidden = attribute_enabled?(value)
    end
  end
  self
end