rails-exporter 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/locales/exporters.en.yml +6 -2
- data/lib/rails_exporter/base.rb +7 -6
- data/lib/rails_exporter/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81bb6b6cc49c8bdb659aa048e5fbdbfcb226f0d0
|
4
|
+
data.tar.gz: bdd1d68b1922c5656ee4b5a49a7164654be1728c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96b68fad1cdee09a587e91da4c92b9209b087adb3cae473b8b68027fa3cad3d0db61588ba7184122356fd0549f494e34ebbd43a64d31067d5db573225718946b
|
7
|
+
data.tar.gz: 570d1740faea715a4074654c6418641a7c92930c11ac6a00d386c9f99883677cb1d222306dc399f270eec6b24b03b534675d7f175c0bef5d60aa0a66c6ff55c5
|
data/lib/rails_exporter/base.rb
CHANGED
@@ -17,11 +17,11 @@ module RailsExporter
|
|
17
17
|
# end
|
18
18
|
# end
|
19
19
|
|
20
|
-
def exporter(
|
21
|
-
(self.exporters ||= {})[
|
22
|
-
@
|
20
|
+
def exporter(context=:default, &block)
|
21
|
+
(self.exporters ||= {})[context] ||= []
|
22
|
+
@exporter_context = context
|
23
23
|
block.call if block_given?
|
24
|
-
self.exporters[
|
24
|
+
self.exporters[context]
|
25
25
|
end
|
26
26
|
|
27
27
|
def column(attr, &block)
|
@@ -33,8 +33,9 @@ module RailsExporter
|
|
33
33
|
type = :string
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
|
36
|
+
exporter_name_without_suffix = self.to_s.underscore.gsub('_exporter','')
|
37
|
+
label = I18n.t("#{@exporter_context}.#{attribute}", default: [attribute.to_sym, attribute.to_s.humanize], scope: [:exporters, exporter_name_without_suffix])
|
38
|
+
self.exporters[@exporter_context] << {column: attribute, label: label, type: normalize_type(type), block: (block_given? ? block : nil)}
|
38
39
|
end
|
39
40
|
|
40
41
|
def columns(exporter_name=:default)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-exporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno Porto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
115
|
rubyforge_project:
|
116
|
-
rubygems_version: 2.
|
116
|
+
rubygems_version: 2.6.8
|
117
117
|
signing_key:
|
118
118
|
specification_version: 4
|
119
119
|
summary: Rails Exporter
|