as_json_representations 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/as_json_representations/collection.rb +12 -6
- data/lib/as_json_representations/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: 7faf28c845c3b7832fba7ffee9a65652e21cd958620644dbc0a9ba7a451d8c76
|
4
|
+
data.tar.gz: f35552a18dddb0be28fa057741127834aadf64969f7f64a662d24050e27dc7f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 361dbc0c1965bbf56a59eb9a0138f00cb52f20dd9f57f6ec035507977175bacb5a384bbaa846f51aac7488ce7773f394e4c1235d45e278a0826e19c04e00ffcc
|
7
|
+
data.tar.gz: 4383c6c23e6bcc495ae13ade123bcde28f19d5945ab59e1520f51d0597620abdb44bcedeaf5255af11910d1006f21a4b13c39e6bfb77c5fe9b97a7a426abfeea
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,19 @@
|
|
1
1
|
module AsJsonRepresentations
|
2
2
|
module Collection
|
3
|
-
def as_json(options={})
|
4
|
-
map do |item|
|
5
|
-
item.respond_to?(:as_json) ? item.as_json(options) : item
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
3
|
def representation(name, options={})
|
10
4
|
as_json(options.merge(representation: name))
|
11
5
|
end
|
6
|
+
|
7
|
+
def self.included(base)
|
8
|
+
return if base.respond_to? :as_json
|
9
|
+
|
10
|
+
base.class_eval do
|
11
|
+
def as_json(options={})
|
12
|
+
map do |item|
|
13
|
+
item.respond_to?(:as_json) ? item.as_json(options) : item
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
12
18
|
end
|
13
19
|
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.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rjurado01
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|