as_json_representations 0.1.0 → 0.2.0
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 +5 -5
- data/Gemfile.lock +2 -2
- data/README.md +3 -1
- data/lib/as_json_representations/version.rb +1 -1
- data/lib/as_json_representations.rb +5 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6d7ce0e4ea64715ea7104e752ce7a5e19ae965cb65dcd5c771a677224578e1e6
|
4
|
+
data.tar.gz: fcefce4937dfb9ffc67723f7f263f81ca1f13cbe7ecbf152bc174b4713110c38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 179b536f2bd9c3f2cfea67f97dcfae09d827e1cebf9dd10f0702145ce2a0fe61ddd921f0285e625446e30fe93bd13d64a4aa4c9498d89dd4aafc3a999e87745a
|
7
|
+
data.tar.gz: e7d6806a997899b7b10cb90b33a6563151c840579b65ccda89c0e59997d09e98a53574b54f99889c3b163b40385ffa1a52f9f2d21337bbad35de3a67add9f55a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# AsJsonRepresentations
|
2
|
+
[](https://badge.fury.io/rb/as_json_representations)
|
3
|
+

|
2
4
|
|
3
5
|
Creates representations of your model data in a simple and clean way.
|
4
6
|
|
@@ -43,7 +45,7 @@ class User
|
|
43
45
|
}
|
44
46
|
end
|
45
47
|
|
46
|
-
representation :private, extend: :public do # you can extends
|
48
|
+
representation :private, extend: :public do # you can extends another representations
|
47
49
|
{
|
48
50
|
age: age,
|
49
51
|
city: city.as_json(representation: :basic)
|
@@ -31,7 +31,11 @@ module AsJsonRepresentations
|
|
31
31
|
base.class_eval do
|
32
32
|
eval %{
|
33
33
|
def as_json(options={})
|
34
|
-
|
34
|
+
if !options[:representation] && defined?(super)
|
35
|
+
super(options)
|
36
|
+
else
|
37
|
+
#{base}.render_representation(self, options)
|
38
|
+
end
|
35
39
|
end
|
36
40
|
}
|
37
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: as_json_representations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rjurado01
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
version: '0'
|
93
93
|
requirements: []
|
94
94
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.
|
95
|
+
rubygems_version: 2.7.3
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: Creates representations of your model data
|