comment_attribute 0.1.2 → 0.1.3
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/comment_attribute/comment_attribute.rb +8 -0
- data/lib/comment_attribute/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: 4203997a9b20a27ee7038717f95cdb9cd9c16d6da3d281a9dff58ba55650ede5
|
4
|
+
data.tar.gz: bceba99f45909ed5f331b6ab3de5c185b595619d43367180686c49e86e009627
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ea98490a5b4fbf0f8d9a02d7b7c01716b469056585436c30880aa85c4e35c83465cae124443cf6b8ea83a17fca66b42e54294eea0ff000a53f5d76ad240b984
|
7
|
+
data.tar.gz: 4f3d02d6a58be0d91a069f5d7cb89d1e7bc38a70ca0848c91cadac56399cfe79c07acdb7651bda550463ea52ec05334b1dc7678ffd653d344e9cf468d3baf659
|
@@ -14,5 +14,13 @@ module CommentAttribute
|
|
14
14
|
def comment_to_attr_name(comment)
|
15
15
|
self.class.columns.find{|r| r.comment == comment }&.name
|
16
16
|
end
|
17
|
+
|
18
|
+
def attr_name_to_comment(attr_name)
|
19
|
+
self.class.columns.find{|r| r.name == attr_name.to_s }&.comment
|
20
|
+
end
|
21
|
+
|
22
|
+
def comments
|
23
|
+
Hash[*attributes.map{|k, v| [attr_name_to_comment(k) || k, v]}.flatten]
|
24
|
+
end
|
17
25
|
end
|
18
26
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comment_attribute
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nizoraul
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|