object_attorney 0.0.14 → 0.0.15
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 +8 -8
- data/lib/object_attorney.rb +14 -11
- data/lib/object_attorney/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzYwNjRlODU3YjdhMGJhMDRmZjA3M2NmODRhZDBlZjAyYjIyMTIwNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDg3YTQ2ZjYyM2JmNjIwNzI2OTA5YTFhNjZkM2Y4MWUwYmQzOWI0YQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjEyNGU5YWRiMTYxY2MxOGY0OWIwZGEyOGRlZWI0M2UzN2FhN2NmNTY5ZDkw
|
10
|
+
ZDYyY2ZkOWM3YTAzM2FiYzBlMTI0MmNiMjVmOGI5YmQ0MjZiY2VlZjE5Yjc3
|
11
|
+
YzZlYTNhNzIzNmQxMGVlOWY3ZmQ0MjIzMjM4ODQzNjY4NzEyZTY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDA4NTdkNzRlZTBlZDMyYWRkNjRiODJjMzNmOWU1OTI2MzZmMGFjYWFlNWFk
|
14
|
+
MzUwMGNjMjNhZDczMGJlMzJkMjg0MDllYzQzYTkzMWVmYmIyODc5NGViNDdi
|
15
|
+
N2ExNDMzNGZiNzkzMDY2NjE0ZTFiMDZlYTlhZjc1NTk2ZDEyNGU=
|
data/lib/object_attorney.rb
CHANGED
@@ -123,18 +123,21 @@ module ObjectAttorney
|
|
123
123
|
end
|
124
124
|
|
125
125
|
def human_attribute_name(attribute_key_name, options = {})
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
126
|
+
no_translation = "-- no translation --"
|
127
|
+
|
128
|
+
defaults = ["object_attorney.attributes.#{name.underscore}.#{attribute_key_name}".to_sym]
|
129
|
+
defaults << options[:default] if options[:default]
|
130
|
+
defaults.flatten!
|
131
|
+
defaults << no_translation
|
132
|
+
options[:count] ||= 1
|
133
|
+
|
134
|
+
translation = I18n.translate(defaults.shift, options.merge(default: defaults))
|
135
|
+
|
136
|
+
if translation == no_translation && represented_object_class.respond_to?(:human_attribute_name)
|
137
|
+
translation = represented_object_class.human_attribute_name(attribute_key_name, options)
|
137
138
|
end
|
139
|
+
|
140
|
+
translation
|
138
141
|
end
|
139
142
|
|
140
143
|
def model_name
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: object_attorney
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- João Gonçalves
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|