xlsxtream_rails 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -13
- data/lib/xlsxtream_rails/railtie.rb +0 -5
- data/lib/xlsxtream_rails/version.rb +1 -1
- metadata +3 -4
- data/lib/xlsxtream_rails/template_handler.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abbdd2ed40b9778899f75dcf87ded14f9a1f1f8b0d9d1644123ef93e4bbc6bb3
|
4
|
+
data.tar.gz: a91d3281e92d57977011198a4f19a656fb17f22fd0569df6d6d14868c63efe49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e65e4414b26b6147e3a1b15d0a9ecde53c858ace2a1fa47063e91c346a278fb90cac60b8aeb926441c66afa13208fe328836578546dfd516f432c559eccedbe
|
7
|
+
data.tar.gz: 5722f6a0e4ca69c813bbe872f9fc7be16860eef3b17399d1690cb821b1ea090d1fd54f429f212e508c9584fa735e7b943be1be24ccd08515af859bf07cb997ad
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# XlsxtreamRails
|
2
|
-
Xlsx stream download for rails
|
2
|
+
Xlsx stream download for rails.
|
3
3
|
|
4
4
|
## Installation
|
5
5
|
Add this line to your application's Gemfile:
|
@@ -61,18 +61,6 @@ class Post < ApplicationRecord
|
|
61
61
|
end
|
62
62
|
```
|
63
63
|
|
64
|
-
## View
|
65
|
-
|
66
|
-
If you want to render with template, you can create the template with the .xlsx.xrb extension (index.xlsx.xrb for example)
|
67
|
-
|
68
|
-
```ruby
|
69
|
-
xlsx.write_worksheet do |sheet|
|
70
|
-
@posts.find_each do |post|
|
71
|
-
sheet.add_row [post.id, post.title]
|
72
|
-
end
|
73
|
-
end
|
74
|
-
```
|
75
|
-
|
76
64
|
## This gem is inspired by the following
|
77
65
|
|
78
66
|
[spreadsheet_architect](https://github.com/westonganger/spreadsheet_architect)
|
@@ -1,11 +1,6 @@
|
|
1
1
|
module XlsxtreamRails
|
2
2
|
class Railtie < ::Rails::Railtie
|
3
3
|
initializer "xlsxtream_rails.initialization" do
|
4
|
-
ActiveSupport.on_load(:action_view) do
|
5
|
-
require "xlsxtream_rails/template_handler"
|
6
|
-
ActionView::Template.register_template_handler :xrb, ActionView::Template::Handlers::XrbBuilder.new
|
7
|
-
end
|
8
|
-
|
9
4
|
ActiveSupport.on_load(:action_controller) do
|
10
5
|
require "xlsxtream_rails/action_controller"
|
11
6
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xlsxtream_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- doabit
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.4.0
|
41
|
-
description: Xlsx stream download for rails
|
41
|
+
description: Xlsx stream download for rails.
|
42
42
|
email:
|
43
43
|
- doinsist@gmail.com
|
44
44
|
executables: []
|
@@ -52,7 +52,6 @@ files:
|
|
52
52
|
- lib/xlsxtream_rails.rb
|
53
53
|
- lib/xlsxtream_rails/action_controller.rb
|
54
54
|
- lib/xlsxtream_rails/railtie.rb
|
55
|
-
- lib/xlsxtream_rails/template_handler.rb
|
56
55
|
- lib/xlsxtream_rails/utils.rb
|
57
56
|
- lib/xlsxtream_rails/version.rb
|
58
57
|
homepage: https://github.com/ruby-gems/xlsxtream_rails
|
@@ -80,5 +79,5 @@ requirements: []
|
|
80
79
|
rubygems_version: 3.2.3
|
81
80
|
signing_key:
|
82
81
|
specification_version: 4
|
83
|
-
summary: Xlsx stream download for rails
|
82
|
+
summary: Xlsx stream download for rails.
|
84
83
|
test_files: []
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require "action_view"
|
2
|
-
require "stringio"
|
3
|
-
|
4
|
-
module ActionView
|
5
|
-
module Template::Handlers
|
6
|
-
class XrbBuilder
|
7
|
-
def default_format
|
8
|
-
Mime[:xlsx].symbol
|
9
|
-
end
|
10
|
-
|
11
|
-
def call(template, source = nil)
|
12
|
-
builder = StringIO.new
|
13
|
-
builder << "# encoding: utf-8\n"
|
14
|
-
builder << (source || template.source)
|
15
|
-
builder.string
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|