-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b33ad3a
commit 3a6f02d
Showing
10 changed files
with
43 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
appraise "axlsx master" do | ||
gem "axlsx", git: "https://github.com/randym/axlsx.git" | ||
appraise "caxlsx" do | ||
gem "caxlsx" # Ruby 2.3+ | ||
end | ||
|
||
appraise "axlsx 3.0.0.pre" do | ||
gem "axlsx", "3.0.0.pre" | ||
appraise "caxlsx 3.0.0" do | ||
gem "caxlsx", "3.0.0" # Ruby 1.9.3+ | ||
end | ||
|
||
appraise "axlsx 2.x" do | ||
gem "axlsx", "~> 2.0" | ||
appraise "caxlsx 2.0.2" do | ||
gem "caxlsx", "2.0.2" # Legacy Axlsx Support | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,6 @@ | ||
source 'https://rubygems.org' | ||
|
||
### `responders` gem must remain in the Gemfile, not gemspec | ||
### otherwise Rails integration tests fail | ||
### Must remain in the Gemfile, not gemspec, otherwise Rails integration tests fail | ||
gem 'responders' | ||
|
||
### By default test against `axlsx` master | ||
### Will be overridden by anything in Appraisal file | ||
gem 'axlsx', git: 'https://github.com/randym/axlsx.git' | ||
|
||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,6 @@ | |
source "https://rubygems.org" | ||
|
||
gem "responders" | ||
gem "axlsx", "~> 2.0" | ||
gem "caxlsx" | ||
|
||
gemspec path: "../" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,6 @@ | |
source "https://rubygems.org" | ||
|
||
gem "responders" | ||
gem "axlsx", "3.0.0.pre" | ||
gem "caxlsx", "2.0.2" | ||
|
||
gemspec path: "../" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 20 additions & 48 deletions
68
lib/spreadsheet_architect/monkey_patches/axlsx_column_width.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,28 @@ | ||
if RUBY_VERSION.to_f >= 2 | ||
|
||
module SpreadsheetArchitect | ||
module AxlsxColumnWidthPatch | ||
def initialize(*args) | ||
@width = nil | ||
super | ||
end | ||
|
||
def width=(v) | ||
if v.nil? | ||
@custom_width = false | ||
@width = nil | ||
elsif @width.nil? || @width < v+5 | ||
@custom_width = true | ||
@best_fit = true | ||
@width = v + 5 | ||
else | ||
@custom_width = true | ||
@width = v | ||
end | ||
end | ||
module SpreadsheetArchitect | ||
module AxlsxColumnWidthPatch | ||
def initialize(*args) | ||
@width = nil | ||
super | ||
end | ||
end | ||
|
||
module Axlsx | ||
class Col | ||
prepend ::SpreadsheetArchitect::AxlsxColumnWidthPatch | ||
end | ||
end | ||
|
||
else | ||
|
||
module Axlsx | ||
class Col | ||
original_initialize = instance_method(:initialize) | ||
define_method :initialize do |*args| | ||
def width=(v) | ||
if v.nil? | ||
@custom_width = false | ||
@width = nil | ||
|
||
original_initialize.bind(self).(*args) | ||
end | ||
|
||
def width=(v) | ||
if v.nil? | ||
@custom_width = false | ||
@width = nil | ||
elsif @width.nil? || @width < v+5 | ||
@custom_width = true | ||
@best_fit = true | ||
@width = v + 5 | ||
end | ||
elsif @width.nil? || @width < v+5 | ||
@custom_width = true | ||
@best_fit = true | ||
@width = v + 5 | ||
else | ||
@custom_width = true | ||
@width = v | ||
end | ||
end | ||
end | ||
end | ||
|
||
module Axlsx | ||
class Col | ||
prepend ::SpreadsheetArchitect::AxlsxColumnWidthPatch | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters