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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee41db88d4c2c64577d469e09c24d8a350db3fd5
4
- data.tar.gz: de05db712f656b5802d997637d0b73c2c4191a57
3
+ metadata.gz: edb130e5d2a4506574a9ee233267341ec60cec29
4
+ data.tar.gz: cb71eaa99b8f5ae8b0711413c6a8035ce0eb9681
5
5
  SHA512:
6
- metadata.gz: 9b4d3bcf25b07ffbefcf1eab86250fff4a6faecf023576d4757aaa2a4fa4bd1d93ebb90b412a7f857e4b8c8f439c5e7450bb6b7e32499c51b4bbdd472fff2647
7
- data.tar.gz: 22c327686c6c75bc6b8085d117dc7c67d33c03d42a5c7a8449a508c81ad0dd7467b21a48451ea5c8aa0d98055f8e6c7151c924c45be04c5c86241fc120eff6cb
6
+ metadata.gz: 144868b83b8bc0eac44fc33872c43759eae2d5ab4cdf74370c46e71ecef3ae802947851431ebcf860aaffc5fd4253bd58115eb18ebf893e85a468d891ca63750
7
+ data.tar.gz: 96e73ad707e7e649f2ce7686be070d5bff502c644e9faa2ccc053fac80abd88537cd7032db3494752b71522d21795ba7d81fa43f8ab61b0db246efb83c59441d
data/.travis.yml CHANGED
@@ -5,13 +5,6 @@ rvm:
5
5
 
6
6
  # 1.9 rubies
7
7
  - 1.9.3
8
- - 1.9.2
9
8
  - rbx-19mode
10
9
  - jruby-19mode
11
-
12
- # 1.8 rubies
13
- - ree
14
- - 1.8.7
15
- - jruby-18mode
16
- - rbx-18mode
17
10
  script: "script/ci"
@@ -25,6 +25,6 @@ module Minimapper
25
25
  end
26
26
  end
27
27
 
28
- module Minimapper::Entity::Attributes
28
+ module Minimapper::Entity::Attributes::ClassMethods
29
29
  include Minimapper::Entity::BelongsTo
30
30
  end
@@ -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("#{name}_attributes")
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("#{name}_attributes") || {} # attributes = foo_attributes
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
@@ -1,5 +1,5 @@
1
1
  module Minimapper
2
2
  module Extras
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -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.5.2"
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"
@@ -12,7 +12,6 @@ class Customer
12
12
 
13
13
  has_many :cars
14
14
 
15
- attribute :addresses_attributes
16
15
  has_many :addresses, :serialize => true
17
16
  end
18
17
 
@@ -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.2.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-05-31 00:00:00.000000000 Z
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.5.2
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.5.2
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.0
165
+ rubygems_version: 2.0.3
166
166
  signing_key:
167
167
  specification_version: 4
168
168
  summary: Extras for Minimapper.