Sha256: b15dfda0f85aca2ffaf79dd81b925bbff3b5a289bcb3c457edf105c6edd0851a

Contents?: true

Size: 930 Bytes

Versions: 21

Compression:

Stored size: 930 Bytes

Contents

# frozen_string_literal: true

module OoxmlParser
  # Class for parsing <sheet> tag
  class Sheet < OOXMLDocumentObject
    # @return [String] Name of sheet
    attr_reader :name
    # @return [Integer] SheetId of sheet
    attr_reader :sheet_id
    # @return [Symbol] Specifies if sheet is hidden
    attr_reader :state
    # @return [String] Id of sheet
    attr_reader :id

    def initialize(parent: nil)
      @state = :visible
      super
    end

    # Parse Sheet data
    # @param [Nokogiri::XML:Element] node with Sheet data
    # @return [Sheet] value of Sheet
    def parse(node)
      node.attributes.each do |key, value|
        case key
        when 'name'
          @name = value.value.to_s
        when 'sheetId'
          @sheet_id = value.value.to_i
        when 'state'
          @state = value.value.to_sym
        when 'id'
          @id = value.value.to_s
        end
      end
      self
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
ooxml_parser-0.37.1 lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
ooxml_parser-0.37.0 lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
ooxml_parser-0.36.1 lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
ooxml_parser-0.36.0 lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
ooxml_parser-0.35.0 lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
ooxml_parser-0.34.2 lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
ooxml_parser-0.34.1 lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
ooxml_parser-0.34.0 lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
ooxml_parser-0.33.0 lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
ooxml_parser-0.32.0 lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
ooxml_parser-0.31.0 lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
ooxml_parser-0.30.0 lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
ooxml_parser-0.29.0 lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
ooxml_parser-0.28.0 lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
ooxml_parser-0.27.0 lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
ooxml_parser-0.26.0 lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
ooxml_parser-0.25.0 lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
ooxml_parser-0.24.0 lib/ooxml_parser/xlsx_parser/workbook/sheet.rb
ooxml_parser-0.23.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/sheet.rb
ooxml_parser-0.22.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/sheet.rb