summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorScott <[email protected]>2012-04-05 13:43:01 -0400
committerScott <[email protected]>2012-04-05 13:43:01 -0400
commit71859909ed45618cd57ec82bb6781f062d188b6d (patch)
tree85846b7ff4fb805c71c81c251860094eacfe4686 /lib
parentff5d690f8c3ac8fcab2f9c21d5ddeb699cf0e5ef (diff)
downloadcaxlsx-71859909ed45618cd57ec82bb6781f062d188b6d.tar.gz
caxlsx-71859909ed45618cd57ec82bb6781f062d188b6d.zip
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/axlsx/stylesheet/styles.rb8
1 files changed, 5 insertions, 3 deletions
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