object_attorney 0.0.12 → 0.0.14

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 ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZTExZGJiODQ3MjYzZmFhOWY3YjAxMDk1OTc1ZWMyYzhkOTJhMWUzZA==
5
+ data.tar.gz: !binary |-
6
+ ZGM3YTFmN2FmMjE1NDg5MWM1N2VjZGQ5NzU5NzE1OTQ4MjZlNzI2YQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ NmYwOTExOTEyMDQ1YmJjNjBjMDA0NTYxYjY0ZDVlNTBiNzU3MzgxNTU1NzMw
10
+ MjMwYmZmNjNlNDVhNTllODgwYzAzYTI2ZGI4MmUyOGQ4ZTQ3N2IxYjgwYWVl
11
+ MmEzNGMwNzZhODY2ZGU1ZGUwNzNkZTQzZjNiMTVhOTAwM2U1ZTE=
12
+ data.tar.gz: !binary |-
13
+ YWE1OTNiMjA2NjFkMWVkYzhmZTkwOGZkYWEzYjQ0NWRmYzJjZmY5ZmYyNzRl
14
+ NmNjZjQ1ODhiMzIwZGVhNDQ2ZGMzYmNmNDI2ZWI0ZWRkMTc2NjE5ODRhMjMy
15
+ ZjBlODdkODlkMmE1ZWVhNDNlZjIxZjQwNDIyNTgwZGI4MGJhOTE=
@@ -1,3 +1,3 @@
1
1
  module ObjectAttorney
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.14"
3
3
  end
@@ -123,12 +123,18 @@ module ObjectAttorney
123
123
  end
124
124
 
125
125
  def human_attribute_name(attribute_key_name, options = {})
126
- defaults = ["#{represented_object_class.name.underscore}.#{attribute_key_name}"]
127
- defaults << options[:default] if options[:default]
128
- defaults.flatten!
129
- defaults << attribute_key_name.to_s.humanize
130
- options[:count] ||= 1
131
- I18n.translate(defaults.shift, options.merge(:default => defaults, :scope => [:activerecord, :attributes]))
126
+ if represented_object_class.respond_to?(:human_attribute_name)
127
+ represented_object_class.human_attribute_name(attribute_key_name, options)
128
+ else
129
+ defaults = []
130
+ defaults << "#{represented_object_class.name.underscore}.#{attribute_key_name}" if represented_object_class.present?
131
+ defaults << "#{name.underscore}.#{attribute_key_name}"
132
+ defaults << options[:default] if options[:default]
133
+ defaults.flatten!
134
+ defaults << attribute_key_name.to_s.humanize
135
+ options[:count] ||= 1
136
+ I18n.translate(defaults.shift, options.merge(:default => defaults, :scope => [:activerecord, :attributes]))
137
+ end
132
138
  end
133
139
 
134
140
  def model_name
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: object_attorney
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
5
- prerelease:
4
+ version: 0.0.14
6
5
  platform: ruby
7
6
  authors:
8
7
  - João Gonçalves
@@ -14,7 +13,6 @@ dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -65,27 +60,26 @@ files:
65
60
  homepage: https://github.com/goncalvesjoao/object_attorney
66
61
  licenses:
67
62
  - MIT
63
+ metadata: {}
68
64
  post_install_message:
69
65
  rdoc_options: []
70
66
  require_paths:
71
67
  - lib
72
68
  required_ruby_version: !ruby/object:Gem::Requirement
73
- none: false
74
69
  requirements:
75
70
  - - ! '>='
76
71
  - !ruby/object:Gem::Version
77
72
  version: '0'
78
73
  required_rubygems_version: !ruby/object:Gem::Requirement
79
- none: false
80
74
  requirements:
81
75
  - - ! '>='
82
76
  - !ruby/object:Gem::Version
83
77
  version: '0'
84
78
  requirements: []
85
79
  rubyforge_project:
86
- rubygems_version: 1.8.23
80
+ rubygems_version: 2.0.7
87
81
  signing_key:
88
- specification_version: 3
82
+ specification_version: 4
89
83
  summary: This gem allows you to extract the code responsible for Validations, Nested
90
84
  Objects and Forms, from your model, into a specific class for a specific use case.
91
85
  test_files: []