From 71859909ed45618cd57ec82bb6781f062d188b6d Mon Sep 17 00:00:00 2001 From: Scott Date: Thu, 5 Apr 2012 13:43:01 -0400 Subject: Removed rake 0.8.7 dependency specific to ruby 1.9.2, as it didn't seem to break anything without it Made border definitions access instead of delete hash params, as calling it from within a loop without cloning the style hash was causing it to be empty on subsequent loops. Didn't see any reason to be deleting them. Added :edges param to :border hash to specify [:top,:bottom], etc. If it's absent, defaults to all edges. --- axlsx.gemspec | 2 +- lib/axlsx/stylesheet/styles.rb | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/axlsx.gemspec b/axlsx.gemspec index ae3d2aaa..3aa66863 100644 --- a/axlsx.gemspec +++ b/axlsx.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency 'rmagick4j', '>= 0.3.7' if Object.const_defined? :JRUBY_VERSION s.add_runtime_dependency 'rubyzip', '>= 0.9.5' - s.add_runtime_dependency 'rake', '0.8.7' if RUBY_VERSION == "1.9.2" +# s.add_runtime_dependency 'rake', '0.8.7' if RUBY_VERSION == "1.9.2" s.add_runtime_dependency 'rake', '>= 0.8.7' if ["1.9.3", "1.8.7"].include?(RUBY_VERSION) s.add_development_dependency 'yard' # s.add_development_dependency 'rdiscount' diff --git a/lib/axlsx/stylesheet/styles.rb b/lib/axlsx/stylesheet/styles.rb index 1fb2e9b3..cd8c7139 100644 --- a/lib/axlsx/stylesheet/styles.rb +++ b/lib/axlsx/stylesheet/styles.rb @@ -204,10 +204,12 @@ module Axlsx if borderId.is_a?(Hash) raise ArgumentError, "border hash definitions must include both style and color" unless borderId.keys.include?(:style) && borderId.keys.include?(:color) - s = borderId.delete :style - c = borderId.delete :color + s = borderId[:style] + c = borderId[:color] + edges = borderId[:edges] || [:left, :right, :top, :bottom] + border = Border.new - [:left, :right, :top, :bottom].each {|pr| border.prs << BorderPr.new(:name => pr, :style=>s, :color => Color.new(:rgb => c))} + edges.each {|pr| border.prs << BorderPr.new(:name => pr, :style=>s, :color => Color.new(:rgb => c))} borderId = self.borders << border end -- cgit v1.2.3