buddy_translatable 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/buddy_translatable/core.rb +0 -7
- data/lib/buddy_translatable/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60dc71d022ca5488b44bafbad0f826a331dcaf075a112854b4510bc834877d3d
|
4
|
+
data.tar.gz: fe5b6df65c01eaacff9773718e1201cab8f366b4851f96b75836cb9c629161aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71587e26b2e4f6b90dbac72efe3a86daa0d276a18a2a76e0a1b3031c03cfc095e63590f32b5d97c88887a7c2d59b78a12064898251545cb1ccd040b3d1eee44b
|
7
|
+
data.tar.gz: c3f39f5c5828ebcdbad2654e8c67e772c671e00d701aa755dea9ae18bacad0f00d650212b705768fa529536502b81494a195dae5bd53b8d88d856aa552ca1d1b
|
@@ -5,7 +5,6 @@ module BuddyTranslatable
|
|
5
5
|
def translatable(*attrs, default_key: :de, available_keys: [])
|
6
6
|
available_keys = I18n.available_locales unless available_keys.present?
|
7
7
|
attrs.each do |attr|
|
8
|
-
translatable_sanity_check(attr)
|
9
8
|
define_translatable_methods(attr, default_key)
|
10
9
|
define_translatable_key_methods(attr, available_keys)
|
11
10
|
end
|
@@ -16,17 +15,11 @@ module BuddyTranslatable
|
|
16
15
|
available_keys = BuddyTranslatable.config.available_sales_keys
|
17
16
|
end
|
18
17
|
attrs.each do |attr|
|
19
|
-
translatable_sanity_check(attr)
|
20
18
|
define_translatable_methods(attr, default_key, is_locale: false)
|
21
19
|
define_translatable_key_methods(attr, available_keys)
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
25
|
-
def translatable_sanity_check(attr)
|
26
|
-
msg = "no such column '#{attr}' in '#{name}' model"
|
27
|
-
raise ArgumentError, msg unless column_names.include?(attr.to_s)
|
28
|
-
end
|
29
|
-
|
30
23
|
def define_translatable_methods(attr, default_key, is_locale: true)
|
31
24
|
current_key = lambda do
|
32
25
|
res = I18n.locale
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buddy_translatable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|