excelinator_ruby3 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88eb0a4bb8013d07498efb18c2354beb6f99a84fb3f442da22814ef3530b7be8
|
4
|
+
data.tar.gz: 490977298721f81e1244ce88493ee78b59268858cee45c45d4f45604635d0865
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53e73baa8e3769b826faf0d897de690d05ec61c569643e77f6dda60bb7bfdedb374c3be66db9103f18e4cf03ed9465988768f627958e2980d83376e47da40b51
|
7
|
+
data.tar.gz: bc32ff192ec9446f9b8c3a712387cc0a1c37942f6228b9902438d3430bcbeafeb5dae502f6aaac93b5384d1423c7fadc9e9b62b66d83b5548793d5532747cdd4
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module ExcelinatorRuby3
|
4
4
|
# register as rails module
|
5
5
|
module Rails
|
6
6
|
def self.setup
|
7
7
|
require 'action_controller'
|
8
8
|
|
9
|
-
Mime::Type.register
|
9
|
+
Mime::Type.register ExcelinatorRuby3::MIME_TYPE, :xls
|
10
10
|
|
11
11
|
add_renderer if ::Rails::VERSION::MAJOR >= 3
|
12
12
|
end
|
@@ -21,8 +21,8 @@ module Excelinator
|
|
21
21
|
module ACMixin
|
22
22
|
def send_xls_data(filename, options = {})
|
23
23
|
content = render_to_string(options)
|
24
|
-
xls_content =
|
25
|
-
send_data(xls_content, filename:, type:
|
24
|
+
xls_content = ExcelinatorRuby3.convert_content(content)
|
25
|
+
send_data(xls_content, filename:, type: ExcelinatorRuby3::MIME_TYPE, disposition: 'inline')
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
#
|
2
|
-
module
|
1
|
+
# ExcelinatorRuby3 module
|
2
|
+
module ExcelinatorRuby3
|
3
3
|
MIME_TYPE = 'application/vnd.ms-excel'
|
4
4
|
|
5
5
|
# Detects HTML table content (with a rather stupid regex: /<table/) and re-uses it, or attempts to convert from
|
6
6
|
# CSV if HTML not detected.
|
7
7
|
def self.convert_content(content)
|
8
|
-
content =~ /<table/ ?
|
8
|
+
content =~ /<table/ ? ExcelinatorRuby3.html_as_xls(content) : ExcelinatorRuby3.csv_to_xls(content)
|
9
9
|
end
|
10
10
|
|
11
11
|
# rubocop:disable Metrics/MethodLength
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
require '
|
3
|
+
require 'excelinator_ruby3/xls'
|
4
|
+
require 'excelinator_ruby3/rails'
|
5
|
+
require 'excelinator_ruby3/version'
|
6
6
|
require 'spreadsheet'
|
7
7
|
|
8
8
|
def old_ruby?
|
@@ -16,10 +16,10 @@ else
|
|
16
16
|
end
|
17
17
|
|
18
18
|
if defined?(Rails)
|
19
|
-
|
19
|
+
ExcelinatorRuby3::Rails.setup
|
20
20
|
module ActionController
|
21
21
|
class Base
|
22
|
-
include
|
22
|
+
include ExcelinatorRuby3::Rails::ACMixin
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: excelinator_ruby3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ChrKahl
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-09-
|
13
|
+
date: 2023-09-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: spreadsheet
|
@@ -64,11 +64,11 @@ extensions: []
|
|
64
64
|
extra_rdoc_files: []
|
65
65
|
files:
|
66
66
|
- README.md
|
67
|
-
- lib/
|
68
|
-
- lib/
|
69
|
-
- lib/
|
70
|
-
- lib/
|
71
|
-
homepage: https://github.com/chrkahl/
|
67
|
+
- lib/excelinator_ruby3.rb
|
68
|
+
- lib/excelinator_ruby3/rails.rb
|
69
|
+
- lib/excelinator_ruby3/version.rb
|
70
|
+
- lib/excelinator_ruby3/xls.rb
|
71
|
+
homepage: https://github.com/chrkahl/excelinator_ruby3
|
72
72
|
licenses: []
|
73
73
|
metadata: {}
|
74
74
|
post_install_message:
|