diff options
| author | Stefan Daschek <[email protected]> | 2019-12-03 13:11:58 +0100 |
|---|---|---|
| committer | Stefan Daschek <[email protected]> | 2019-12-03 13:11:58 +0100 |
| commit | bf2cb814f65a1111715a698570b658d20ceb5a5b (patch) | |
| tree | 3a1d304d846899dfcf8cccada0afbbe74d3cb10b | |
| parent | c1307a3fff72e86074ae19b3d33f79ebebd5e3e6 (diff) | |
| download | caxlsx-bf2cb814f65a1111715a698570b658d20ceb5a5b.tar.gz caxlsx-bf2cb814f65a1111715a698570b658d20ceb5a5b.zip | |
Remove unused / stubbed code related to parsing xlsx files
This code was added in 3def8f8895 (back in 2011). It has never been worked on further since; `Axlsx::Parser` is not used anywhere in the whole codebase.
Currently there are no plans to support parsing xlsx file anytime soon, so let‘s remove all of this dead code.
| -rw-r--r-- | lib/axlsx.rb | 2 | ||||
| -rw-r--r-- | lib/axlsx/package.rb | 8 | ||||
| -rw-r--r-- | lib/axlsx/util/parser.rb | 44 | ||||
| -rw-r--r-- | lib/axlsx/workbook/workbook.rb | 9 |
4 files changed, 0 insertions, 63 deletions
diff --git a/lib/axlsx.rb b/lib/axlsx.rb index 23fc6c8b..e60660b6 100644 --- a/lib/axlsx.rb +++ b/lib/axlsx.rb @@ -9,8 +9,6 @@ require 'axlsx/util/validators.rb' require 'axlsx/util/accessors.rb' require 'axlsx/util/serialized_attributes' require 'axlsx/util/options_parser' -# to be included with parsable intitites. -#require 'axlsx/util/parser.rb' require 'axlsx/util/mime_type_utils' require 'axlsx/stylesheet/styles.rb' diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb index 56410339..56047f02 100644 --- a/lib/axlsx/package.rb +++ b/lib/axlsx/package.rb @@ -68,13 +68,6 @@ module Axlsx @workbook end - #def self.parse(input, confirm_valid = false) - # p = Package.new - # z = Zip::File.open(input) - # p.workbook = Workbook.parse z.get_entry(WORKBOOK_PN) - # p - #end - # @see workbook def workbook=(workbook) DataTypeValidator.validate :Package_workbook, Workbook, workbook; @workbook = workbook; end @@ -355,4 +348,3 @@ module Axlsx end end end - diff --git a/lib/axlsx/util/parser.rb b/lib/axlsx/util/parser.rb deleted file mode 100644 index 78b819bd..00000000 --- a/lib/axlsx/util/parser.rb +++ /dev/null @@ -1,44 +0,0 @@ -# encoding: UTF-8 -module Axlsx - # The Parser module mixes in a number of methods to help in generating a model from xml - # This module is not included in the axlsx library at this time. It is for future development only, - module Parser - - # The xml to be parsed - attr_accessor :parser_xml - - # parse and assign string attribute - def parse_string attr_name, xpath - send("#{attr_name}=", parse_value(xpath)) - end - - # parse convert and assign node text to symbol - def parse_symbol attr_name, xpath - v = parse_value xpath - v = v.to_sym unless v.nil? - send("#{attr_name}=", v) - end - - # parse, convert and assign note text to integer - def parse_integer attr_name, xpath - v = parse_value xpath - v = v.to_i if v.respond_to?(:to_i) - send("#{attr_name}=", v) - end - - # parse, convert and assign node text to float - def parse_float attr_name, xpath - v = parse_value xpath - v = v.to_f if v.respond_to?(:to_f) - send("#{attr_name}=", v) - end - - # return node text based on xpath - def parse_value xpath - node = parser_xml.xpath(xpath) - return nil if node.empty? - node.text.strip - end - - end -end diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb index 7572e51f..48b7f882 100644 --- a/lib/axlsx/workbook/workbook.rb +++ b/lib/axlsx/workbook/workbook.rb @@ -197,15 +197,6 @@ require 'axlsx/workbook/worksheet/selection.rb' @worksheets[index] if index end - # lets come back to this later when we are ready for parsing. - #def self.parse entry - # io = entry.get_input_stream - # w = self.new - # w.parser_xml = Nokogiri::XML(io.read) - # w.parse_string :date1904, "//xmlns:workbookPr/@date1904" - # w - #end - # Creates a new Workbook # The recomended way to work with workbooks is via Package#workbook # @option options [Boolean] date1904. If this is not specified, date1904 is set to false. Office 2011 for Mac defaults to false. |
