lib/axlsx.rb in axlsx-1.0.16 vs lib/axlsx.rb in axlsx-1.0.17

- old
+ new

@@ -1,16 +1,14 @@ -Encoding::default_internal = 'UTF-8' unless RUBY_VERSION < '1.9' -Encoding::default_external = 'UTF-8' unless RUBY_VERSION < '1.9' - +# encoding: UTF-8 require 'axlsx/version.rb' require 'axlsx/util/simple_typed_list.rb' require 'axlsx/util/constants.rb' require 'axlsx/util/validators.rb' -# require 'axlsx/util/storage.rb' -# require 'axlsx/util/cbf.rb' -# require 'axlsx/util/ms_off_crypto.rb' +require 'axlsx/util/storage.rb' +require 'axlsx/util/cbf.rb' +require 'axlsx/util/ms_off_crypto.rb' # to be included with parsable intitites. #require 'axlsx/util/parser.rb' @@ -25,17 +23,25 @@ require 'axlsx/workbook/workbook.rb' require 'axlsx/package.rb' #required gems require 'nokogiri' -require 'active_support/core_ext/object/instance_variables' -require 'active_support/inflector' require 'RMagick' require 'zip/zip' #core dependencies require 'bigdecimal' require 'time' + +#if object does not have this already, I am borrowing it from active_support. +# I am a very big fan of activesupports instance_values method, but do not want to require nor include the entire +# library just for this one method. +if !Object.respond_to?(:instance_values) + Object.send :public # patch for 1.8.7 as it uses private scope + Object.send :define_method, :instance_values do + Hash[instance_variables.map { |name| [name.to_s[1..-1], instance_variable_get(name)] }] + end +end # xlsx generation with charts, images, automated column width, customizable styles and full schema validation. Axlsx excels at helping you generate beautiful Office Open XML Spreadsheet documents without having to understand the entire ECMA specification. Check out the README for some examples of how easy it is. Best of all, you can validate your xlsx file before serialization so you know for sure that anything generated is going to load on your client's machine. module Axlsx # determines the cell range for the items provided