rails-exporter 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3e9fca6ddec088172bafe5c109837b7e5207e84
4
- data.tar.gz: 417f1b2f1e4e652ca925c67060bb05e5775fb9a2
3
+ metadata.gz: 81bb6b6cc49c8bdb659aa048e5fbdbfcb226f0d0
4
+ data.tar.gz: bdd1d68b1922c5656ee4b5a49a7164654be1728c
5
5
  SHA512:
6
- metadata.gz: aa9ef279055d40601d22dcfb92e2a1a53042934b0c9de52242838509d067dddb084646e4b957beef81135d5d374b9136c9616230bf0d083410d8f645912ec0e3
7
- data.tar.gz: eb62e241a3476b6955b080fffa7eb040da0db8366237f373c748e1c63b7da8ecdd60e46de9ab1d917c84ec5ce63d2d51188b15348698a8d746c8c07258c34962
6
+ metadata.gz: 96b68fad1cdee09a587e91da4c92b9209b087adb3cae473b8b68027fa3cad3d0db61588ba7184122356fd0549f494e34ebbd43a64d31067d5db573225718946b
7
+ data.tar.gz: 570d1740faea715a4074654c6418641a7c92930c11ac6a00d386c9f99883677cb1d222306dc399f270eec6b24b03b534675d7f175c0bef5d60aa0a66c6ff55c5
@@ -4,5 +4,9 @@ en:
4
4
  example:
5
5
  name: 'Name'
6
6
  another_example:
7
- name: 'Name'
8
- age: 'Age'
7
+ default:
8
+ name: 'My Name'
9
+ age: 'My Age'
10
+ context_name:
11
+ name: 'Name'
12
+ age: 'Age'
@@ -17,11 +17,11 @@ module RailsExporter
17
17
  # end
18
18
  # end
19
19
 
20
- def exporter(name=:default, &block)
21
- (self.exporters ||= {})[name] ||= []
22
- @exporter_name = name
20
+ def exporter(context=:default, &block)
21
+ (self.exporters ||= {})[context] ||= []
22
+ @exporter_context = context
23
23
  block.call if block_given?
24
- self.exporters[name]
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
- label = I18n.t(attribute, default: [attribute.to_s.humanize], scope: [:exporters, @exporter_name])
37
- self.exporters[@exporter_name] << {column: attribute, label: label, type: normalize_type(type), block: (block_given? ? block : nil)}
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)
@@ -1,3 +1,3 @@
1
1
  module RailsExporter
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
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.8
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-13 00:00:00.000000000 Z
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.5.1
116
+ rubygems_version: 2.6.8
117
117
  signing_key:
118
118
  specification_version: 4
119
119
  summary: Rails Exporter