effective_resources 2.4.0 → 2.4.1

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
  SHA256:
3
- metadata.gz: 9fc4b2cb86902bbdc801204584d765041a0dded527e894eace36d5ea8d923f3f
4
- data.tar.gz: ff36581881c3d5dd3667787cf0395c8b6b7b15676e583ac90e85c3e681a02a10
3
+ metadata.gz: 9c82abcba44a0a6d2488c79bef898d95a025eb976112f4a2dcf04821bb3658d3
4
+ data.tar.gz: 62793269ccfec2f9ec332e85c8b308de04980f89964aff98e20af91adc70bda7
5
5
  SHA512:
6
- metadata.gz: a6bf9ede63c06935ee24d72e7b11d78950b7b1b2e3540338513ab18be3570a13e14189252279872f485f1755378ab180f4d3b517ad1e2c2b2564b2a9952035e9
7
- data.tar.gz: 72aa0f77cef8f2f8477a50e50990a51eaf592e5889811a689e4a9fa095e5adb072d6cd8c626fd3945e831f22e4fb6b37d53a2b2349648d71320561b7244ad26a
6
+ metadata.gz: 9ce34a3a0f0aaa6ecbbe14540ef045e21cc87e32cfee26d1ccb14a1a105e5f386743925b45983cc8c6b217ba228714c35f1d7442c8fdcb971e60ff790dc8f143
7
+ data.tar.gz: d52c0fdbca5a98fa7cc1719d5343199566604eeab786f1de3bd18f5dedbf9879c150f877d78eb7400ec424cbd601ca53845a5009c392368f1a911ebc4363e0c2
@@ -300,15 +300,26 @@ module EffectiveResourcesHelper
300
300
  path || '/'
301
301
  end
302
302
 
303
- def effective_translate(resource, attribute = nil)
303
+ # effective_translate
304
+ def et(resource, attribute = nil)
304
305
  EffectiveResources.et(resource, attribute)
305
306
  end
306
307
 
307
- def effective_translates(resource, attribute = nil)
308
+ # effective_translate_plural
309
+ def etd(resource, attribute = nil)
310
+ EffectiveResources.etd(resource, attribute)
311
+ end
312
+
313
+ # effective_translate_plural
314
+ def ets(resource, attribute = nil)
308
315
  EffectiveResources.ets(resource, attribute)
309
316
  end
310
317
 
311
- alias_method :et, :effective_translate
312
- alias_method :ets, :effective_translates
318
+ # effective_translate_plural
319
+ def etsd(resource, attribute = nil)
320
+ EffectiveResources.etsd(resource, attribute)
321
+ end
322
+
323
+
313
324
 
314
325
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.4.0'.freeze
2
+ VERSION = '2.4.1'.freeze
3
3
  end
@@ -179,9 +179,11 @@ module EffectiveResources
179
179
  end
180
180
 
181
181
  def self.et(resource, attribute = nil)
182
- return I18n.t(resource) unless resource.respond_to?(:model_name)
183
-
184
- if attribute.blank?
182
+ if resource.respond_to?(:model_name) == false
183
+ value = I18n.t(resource)
184
+ raise("Missing translation: #{resource}") if value.start_with?('translation missing:')
185
+ value
186
+ elsif attribute.blank?
185
187
  resource.model_name.human
186
188
  elsif resource.respond_to?(:human_attribute_name)
187
189
  resource.human_attribute_name(attribute)
@@ -190,8 +192,16 @@ module EffectiveResources
190
192
  end
191
193
  end
192
194
 
195
+ def self.etd(resource, attribute = nil)
196
+ et(resource, attribute).downcase
197
+ end
198
+
193
199
  def self.ets(resource, attribute = nil)
194
200
  et(resource, attribute).pluralize
195
201
  end
196
202
 
203
+ def self.etsd(resource, attribute = nil)
204
+ et(resource, attribute).pluralize.downcase
205
+ end
206
+
197
207
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect