coaster 1.3.24 → 1.3.26
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: '0508a1aac1a7bd5b88db6d62d5a928a870f5a34763fcf6e578390fd0b8b2a0e9'
|
4
|
+
data.tar.gz: ede4991485b4ca7e1df33b31087ece02ba6aa614e36d007f6c7331b31d91c166
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa917d7790fa7beda1a4d7a70d188a606af266bdd26c72703af5e598a50cf74db8498835d5c4c9fc8b1f574f9ec5a2af3bdd98ee5553efa63b8b078442503091
|
7
|
+
data.tar.gz: 7e694dda54a52511f5e1c83b61d7396b33b89bfdb144799ef04dc07d4a0dd7b6c22003baaafd237800f5246a17578f8a58403db3fa6c1880008e0d2cadaa3c2a
|
@@ -45,6 +45,11 @@ class Object
|
|
45
45
|
|
46
46
|
if key_class.superclass == Object || key_class == Object
|
47
47
|
return options[:description] if options[:description].present?
|
48
|
+
case options[:fallback]
|
49
|
+
when Proc then return options[:fallback].call(self)
|
50
|
+
when Symbol then return self.send(options[:fallback])
|
51
|
+
when String then return options[:fallback]
|
52
|
+
end
|
48
53
|
if Coaster.logger
|
49
54
|
Coaster.logger.info(options[:original_missing])
|
50
55
|
Coaster.logger.debug(caller.join("\n"))
|
data/lib/coaster/version.rb
CHANGED
@@ -27,6 +27,12 @@ module Coaster
|
|
27
27
|
assert_equal 'translation missing: en.class.Coaster.NotTranslated.self', NotTranslated._translate
|
28
28
|
end
|
29
29
|
|
30
|
+
def test_fallback
|
31
|
+
assert_equal 'Coaster::NotTranslated', NotTranslated._translate(fallback: :name)
|
32
|
+
assert_equal 'aabbcc', NotTranslated._translate(fallback: 'aabbcc')
|
33
|
+
assert_equal 'Coaster::NotTranslated..aabb', NotTranslated._translate(fallback: proc{|klass| "#{klass.name}..aabb"})
|
34
|
+
end
|
35
|
+
|
30
36
|
def test_raise_translation_missing
|
31
37
|
exception = catch(:exception) do
|
32
38
|
NotTranslated._translate(throw: true)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coaster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- buzz jung
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|