minimapper-extras 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -7
- data/lib/minimapper/entity/belongs_to.rb +1 -1
- data/lib/minimapper/entity/has_many.rb +5 -2
- data/lib/minimapper/entity/serialized_association.rb +4 -2
- data/lib/minimapper/extras/version.rb +1 -1
- data/minimapper-extras.gemspec +1 -1
- data/spec/minimapper/entity/has_many_spec.rb +0 -1
- data/spec/minimapper/entity/serialized_association_spec.rb +0 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edb130e5d2a4506574a9ee233267341ec60cec29
|
4
|
+
data.tar.gz: cb71eaa99b8f5ae8b0711413c6a8035ce0eb9681
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 144868b83b8bc0eac44fc33872c43759eae2d5ab4cdf74370c46e71ecef3ae802947851431ebcf860aaffc5fd4253bd58115eb18ebf893e85a468d891ca63750
|
7
|
+
data.tar.gz: 96e73ad707e7e649f2ce7686be070d5bff502c644e9faa2ccc053fac80abd88537cd7032db3494752b71522d21795ba7d81fa43f8ab61b0db246efb83c59441d
|
data/.travis.yml
CHANGED
@@ -9,8 +9,11 @@ module Minimapper
|
|
9
9
|
attr_writer name
|
10
10
|
|
11
11
|
if serialize
|
12
|
+
attribute_name = "#{name}_attributes"
|
13
|
+
attribute attribute_name
|
14
|
+
|
12
15
|
setup_has_many(name) do
|
13
|
-
attributes = send(
|
16
|
+
attributes = send(attribute_name)
|
14
17
|
entity_class = name.to_s.singularize.camelcase.constantize
|
15
18
|
(attributes || []).map { |attr| entity_class.new(attr) }
|
16
19
|
end
|
@@ -33,6 +36,6 @@ module Minimapper
|
|
33
36
|
end
|
34
37
|
end
|
35
38
|
|
36
|
-
module Minimapper::Entity::Attributes
|
39
|
+
module Minimapper::Entity::Attributes::ClassMethods
|
37
40
|
include Minimapper::Entity::HasMany
|
38
41
|
end
|
@@ -6,8 +6,10 @@ module Minimapper
|
|
6
6
|
module Entity
|
7
7
|
module SerializedAssociation
|
8
8
|
def serialized_association(name, entity_class_or_proc = nil)
|
9
|
+
attribute_name = "#{name}_attributes"
|
10
|
+
attribute attribute_name
|
9
11
|
define_method(name) do # def foo
|
10
|
-
attributes = public_send(
|
12
|
+
attributes = public_send(attribute_name) || {} # attributes = foo_attributes
|
11
13
|
entity = instance_variable_get("@#{name}") # entity = @foo
|
12
14
|
|
13
15
|
if entity_class_or_proc.is_a?(Proc)
|
@@ -24,7 +26,7 @@ module Minimapper
|
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
27
|
-
module Attributes
|
29
|
+
module Attributes::ClassMethods
|
28
30
|
include SerializedAssociation
|
29
31
|
end
|
30
32
|
end
|
data/minimapper-extras.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
-
spec.add_dependency "minimapper", ">= 0.
|
25
|
+
spec.add_dependency "minimapper", ">= 0.8"
|
26
26
|
spec.add_dependency "attr_extras"
|
27
27
|
spec.add_dependency "backports"
|
28
28
|
spec.add_development_dependency "bundler", "~> 1.3"
|
@@ -26,9 +26,6 @@ class Customer
|
|
26
26
|
include Minimapper::Entity
|
27
27
|
|
28
28
|
attribute :name
|
29
|
-
attribute :address_attributes
|
30
|
-
attribute :visit_address_attributes
|
31
|
-
attribute :custom_address_attributes
|
32
29
|
|
33
30
|
serialized_association :address
|
34
31
|
serialized_association :visit_address, Address
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minimapper-extras
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joakim Kolsjö
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minimapper
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - '>='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.
|
20
|
+
version: '0.8'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - '>='
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.
|
27
|
+
version: '0.8'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: attr_extras
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
162
|
version: '0'
|
163
163
|
requirements: []
|
164
164
|
rubyforge_project:
|
165
|
-
rubygems_version: 2.0.
|
165
|
+
rubygems_version: 2.0.3
|
166
166
|
signing_key:
|
167
167
|
specification_version: 4
|
168
168
|
summary: Extras for Minimapper.
|