ar2dto 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ar2dto/dto.rb +12 -7
- data/lib/ar2dto/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cd53b73405906d2f5110639476b122164c9ed031ee9c790738060616e8b37d9
|
4
|
+
data.tar.gz: 01c473e3681f934e0fca8991d0dd49f637a93920134c4a7baedaefed344e325b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65921f1573108b6cb20bcd39457a51e6e71bd9c1c49e44247f799534c827a362980438aaad65350cf107e627f915ebfd2996c32e4d1969f3aa07196cfe159482
|
7
|
+
data.tar.gz: 8a659e862bafd7fc0165f4b7f38ae385fa22b9550194df05cbb42f11ce0709f8bd5a443cb61c874b7096b41e9e48a3d6dd28379c94899e3ddff2aa67fed1edc8
|
data/lib/ar2dto/dto.rb
CHANGED
@@ -9,14 +9,19 @@ module AR2DTO
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
def initialize(
|
13
|
-
attributes.each { |key, value| define_singleton_method(key) { value } }
|
14
|
-
super()
|
15
|
-
end
|
16
|
-
|
17
|
-
def as_json(options = nil)
|
12
|
+
def initialize(data = {})
|
18
13
|
attribute_names = self.class.original_model.attribute_names
|
19
|
-
|
14
|
+
|
15
|
+
data.each do |key, value|
|
16
|
+
if attribute_names.include?(key)
|
17
|
+
instance_variable_set("@#{key}", value)
|
18
|
+
singleton_class.attr_reader(key)
|
19
|
+
else
|
20
|
+
define_singleton_method(key) { value }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
super()
|
20
25
|
end
|
21
26
|
|
22
27
|
def ==(other)
|
data/lib/ar2dto/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar2dto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Santiago Bartesaghi
|
8
8
|
- Martín Jaime Morón
|
9
9
|
- Sebastian Herrera
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-07-
|
13
|
+
date: 2022-07-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activemodel
|
@@ -124,7 +124,7 @@ dependencies:
|
|
124
124
|
- - "~>"
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: 2.6.0
|
127
|
-
description:
|
127
|
+
description:
|
128
128
|
email:
|
129
129
|
- santib@hey.com
|
130
130
|
- martinmoron7@gmail.com
|
@@ -152,7 +152,7 @@ metadata:
|
|
152
152
|
bug_tracker_uri: https://github.com/santib/ar2dto/issues
|
153
153
|
changelog_uri: https://github.com/santib/ar2dto/releases
|
154
154
|
rubygems_mfa_required: 'true'
|
155
|
-
post_install_message:
|
155
|
+
post_install_message:
|
156
156
|
rdoc_options: []
|
157
157
|
require_paths:
|
158
158
|
- lib
|
@@ -167,8 +167,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
167
|
- !ruby/object:Gem::Version
|
168
168
|
version: '0'
|
169
169
|
requirements: []
|
170
|
-
rubygems_version: 3.
|
171
|
-
signing_key:
|
170
|
+
rubygems_version: 3.0.3
|
171
|
+
signing_key:
|
172
172
|
specification_version: 4
|
173
173
|
summary: Easing the creation of DTOs from your ActiveRecord models.
|
174
174
|
test_files: []
|