azahara_schema 0.2.0 → 0.2.1

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: f2360332cafbd874ede332a5c6daa8b4981aedadc9bc62e9addb5f7af671be39
4
- data.tar.gz: 35b710e037817d93a1cd0a66587a5059a38fb5c7e9145bd62c0f74a461a5d456
3
+ metadata.gz: de52d45e49249449b6a9b9ef878c3ddb2f77d3371d3d3d203db5501ccab9cca6
4
+ data.tar.gz: eb05968e0506eadf9cf96396f965e45b9752edba05f78df24b2e803253e9775e
5
5
  SHA512:
6
- metadata.gz: b55076da88155ecde69588b437a9f3b80c11f07293596f124395a7c3037171185f43b8da07c617ec59513a59cc54951bfa5e9e5631a6bdad1f2f0b507fd2de52
7
- data.tar.gz: 9648b8e08a30a879437d0931a42994bc2089d9b791e4254c87c45bc488fac61582cf82eb6238e35653a15e7f6c58123fd837257ea6ba2cc9684777beae65c623
6
+ metadata.gz: 6aac5dc3fbec9b3b830b9e9c71e798e0591ee5ed1cbda25951f09c416057785dd2f33a5d75db944cb484dc8280f36982c13603d9cd4315cb5582e8719d934706
7
+ data.tar.gz: 98f3dce85c3205df24378c42178d550dd76006109338e251c863ae23606d2e1ac363efd9db1fb72299b91b645c18b90b6ef8af4734a1da7ed781e68106dfc9c7
@@ -32,8 +32,12 @@ module AzaharaSchema
32
32
  (i18n_scope + '.' + i18n_key.to_s).to_sym
33
33
  end
34
34
 
35
- def i18n_scoped_list_key(value)
36
- i18n_scope + '.' + i18n_key.to_s.pluralize + '.' + value.to_s
35
+ def i18n_scoped_list_prefix
36
+ i18n_scope + '.' + i18n_key.to_s.pluralize
37
+ end
38
+
39
+ def i18n_scoped_list_key(value, prefix=self.i18n_scoped_list_prefix)
40
+ prefix + '.' + value.to_s
37
41
  end
38
42
 
39
43
  def i18n_fallback_keys
@@ -47,15 +51,19 @@ module AzaharaSchema
47
51
  end
48
52
  end
49
53
 
50
- def i18n_list_fallback_keys(value)
54
+ def i18n_list_fallback_prefixes
51
55
  if attribute.respond_to?(:attribute)
52
56
  parent_attr_name = attribute.attribute.attribute_name
53
- keys = [ parent_attr_name.i18n_scoped_list_key(value).to_sym ]
54
- keys.concat( parent_attr_name.i18n_list_fallback_keys(value) )
55
- keys
57
+ prefixes = [ parent_attr_name.i18n_scoped_list_prefix ]
58
+ prefixes.concat( parent_attr_name.i18n_list_fallback_prefixes )
59
+ prefixes
56
60
  else
57
61
  []
58
62
  end
59
63
  end
64
+
65
+ def i18n_list_fallback_keys(value)
66
+ prefixes.collect{|pref| i18n_scoped_list_key(value, pref) }
67
+ end
60
68
  end
61
69
  end
@@ -1,3 +1,3 @@
1
1
  module AzaharaSchema
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azahara_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Ezr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-26 00:00:00.000000000 Z
11
+ date: 2018-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails