trenni-formatters 2.8.0 → 2.8.1
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 +4 -4
- data/lib/trenni/formatters/formatter.rb +7 -1
- data/lib/trenni/formatters/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3394bc79205491b32b1ccda3d66f2bf61dac01306735d375c33568386bbae6c1
|
|
4
|
+
data.tar.gz: 3d150680e6494f6b7abaa10eb3b4622f772c69b740c886de05d8c6b371151ffb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 62458096a57b44c43fd13cb5b03d7e75907eea995b8776d7dc60ebac74326b6747d8386c9757aa2e6fbf8549c084b6ffa5245dbf353c6394935fc9b80e4f6f9e
|
|
7
|
+
data.tar.gz: 34a072f941bf47d5ebd6e9959064f5b18ad5bb8aee6002977540ec692e3bc8a33db6b695549f113e2b958a28edc50b956de0f97627cb4a1f5c5f627f262cfbee
|
|
@@ -31,6 +31,8 @@ module Trenni
|
|
|
31
31
|
|
|
32
32
|
def initialize(**options)
|
|
33
33
|
@options = options
|
|
34
|
+
|
|
35
|
+
@object = nil
|
|
34
36
|
end
|
|
35
37
|
|
|
36
38
|
# The target object of the form.
|
|
@@ -38,6 +40,10 @@ module Trenni
|
|
|
38
40
|
@object ||= @options[:object]
|
|
39
41
|
end
|
|
40
42
|
|
|
43
|
+
def nested_name(**options)
|
|
44
|
+
options[:nested_name] || @options[:nested_name]
|
|
45
|
+
end
|
|
46
|
+
|
|
41
47
|
# The name of the field, used for the name attribute of an input.
|
|
42
48
|
def name_for(**options)
|
|
43
49
|
name = options[:name] || options[:field]
|
|
@@ -46,7 +52,7 @@ module Trenni
|
|
|
46
52
|
name = "#{name}#{suffix}"
|
|
47
53
|
end
|
|
48
54
|
|
|
49
|
-
if nested_name = options
|
|
55
|
+
if nested_name = self.nested_name(**options)
|
|
50
56
|
"#{nested_name}[#{name}]"
|
|
51
57
|
else
|
|
52
58
|
name
|