lib/write_xlsx/gradient.rb in write_xlsx-1.09.4 vs lib/write_xlsx/gradient.rb in write_xlsx-1.09.5

- old
+ new

@@ -23,13 +23,11 @@ # Check the positions array has the right number of entries. raise "Gradient positions not equal to numbers of colors" unless args[:positions].size == args[:colors].size # Check the positions are in the correct range. args[:positions].each do |pos| - if pos < 0 || pos > 100 - raise "Gradient position '#{pos} must be in range 0 <= pos <= 100" - end + raise "Gradient position '#{pos} must be in range 0 <= pos <= 100" if pos < 0 || pos > 100 end gradient[:positions] = args[:positions] else # Use the default gradient positions. case args[:colors].size @@ -46,24 +44,22 @@ # Set the gradient angle. if args[:angle] angle = args[:angle] - if angle < 0 || angle > 359.9 - raise "Gradient angle '#{angle} must be in range 0 <= pos < 360" - end + raise "Gradient angle '#{angle} must be in range 0 <= pos < 360" if angle < 0 || angle > 359.9 + gradient[:angle] = angle else gradient[:angle] = 90 end # Set the gradient type. if args[:type] type = args[:type] - unless types[type] - raise "Unknow gradient type '#{type}'" - end + raise "Unknow gradient type '#{type}'" unless types[type] + gradient[:type] = types[type] else gradient[:type] = 'linear' end