deep_copy 0.0.2 → 0.0.3
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.
- data/Gemfile.lock +5 -17
- data/README.md +2 -2
- data/deep_copy.gemspec +2 -2
- metadata +5 -5
data/Gemfile.lock
CHANGED
@@ -1,28 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
deep_copy (0.0.
|
5
|
-
activerecord (
|
4
|
+
deep_copy (0.0.3)
|
5
|
+
activerecord (~> 2.3)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
|
11
|
-
activesupport (= 3.
|
12
|
-
|
13
|
-
i18n (~> 0.4.1)
|
14
|
-
activerecord (3.0.0)
|
15
|
-
activemodel (= 3.0.0)
|
16
|
-
activesupport (= 3.0.0)
|
17
|
-
arel (~> 1.0.0)
|
18
|
-
tzinfo (~> 0.3.23)
|
19
|
-
activesupport (3.0.0)
|
20
|
-
arel (1.0.1)
|
21
|
-
activesupport (~> 3.0.0)
|
22
|
-
builder (2.1.2)
|
23
|
-
i18n (0.4.1)
|
10
|
+
activerecord (2.3.9)
|
11
|
+
activesupport (= 2.3.9)
|
12
|
+
activesupport (2.3.9)
|
24
13
|
rake (0.8.7)
|
25
|
-
tzinfo (0.3.23)
|
26
14
|
|
27
15
|
PLATFORMS
|
28
16
|
ruby
|
data/README.md
CHANGED
@@ -11,11 +11,11 @@ on your environment.rb
|
|
11
11
|
## Usage
|
12
12
|
|
13
13
|
Pick any Active Record object and call _deep\_copy_ on it. You can also include associations and except fields, like this:
|
14
|
-
new_user = user.deep_copy :include => :car, :
|
14
|
+
new_user = user.deep_copy :include => :car, :except => [:name, {:car => [:number_of_wheels, :number_of_accidents]}]
|
15
15
|
In this example we're cloning a user, including its car. However, we're not cloning the user's name nor are we cloning his car's _number\_of\_wheels_ and _number\_of\_accidents_.
|
16
16
|
|
17
17
|
You can also go deeper (bad pun intended). In this example, we'll clone a lot of people (excluding their names):
|
18
|
-
new_son = son.deep_copy :include => [{:parent => grand_parent}, :siblings], :
|
18
|
+
new_son = son.deep_copy :include => [{:parent => grand_parent}, :siblings], :except => [:name, {:parent => [:name, :grand_parent => :name]}, {:siblings => :name}]
|
19
19
|
|
20
20
|
### Acknowledgements
|
21
21
|
|
data/deep_copy.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "deep_copy"
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.3"
|
6
6
|
s.platform = Gem::Platform::RUBY
|
7
7
|
s.authors = ["Gonçalo Silva", "Jan De Poorter"]
|
8
8
|
s.email = ["goncalossilva@gmail.com", "github@defv.be"]
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.required_rubygems_version = ">= 1.3.7"
|
15
15
|
|
16
16
|
# If you have other dependencies, add them here
|
17
|
-
s.add_dependency "activerecord", "
|
17
|
+
s.add_dependency "activerecord", "~> 2.3"
|
18
18
|
|
19
19
|
# If you need to check in files that aren't .rb files, add them here
|
20
20
|
s.files = `git ls-files`.split("\n")
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "Gon\xC3\xA7alo Silva"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-06 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ~>
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
segments:
|
29
29
|
- 2
|
@@ -67,7 +67,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
67
67
|
requirements:
|
68
68
|
- - ">="
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
hash:
|
70
|
+
hash: 441100595
|
71
71
|
segments:
|
72
72
|
- 0
|
73
73
|
version: "0"
|