dm-core 1.0.1 → 1.0.2
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 +1 -1
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/dm-core.gemspec +2 -1
- data/lib/dm-core/associations/many_to_many.rb +1 -1
- data/lib/dm-core/associations/many_to_one.rb +6 -6
- data/lib/dm-core/associations/one_to_many.rb +6 -6
- data/lib/dm-core/associations/relationship.rb +1 -1
- data/lib/dm-core/collection.rb +9 -9
- data/lib/dm-core/core_ext/pathname.rb +2 -2
- data/lib/dm-core/model.rb +1 -1
- data/lib/dm-core/model/property.rb +2 -1
- data/lib/dm-core/property_set.rb +1 -1
- data/lib/dm-core/query.rb +5 -5
- data/lib/dm-core/query/conditions/operation.rb +5 -5
- data/lib/dm-core/repository.rb +1 -1
- data/lib/dm-core/resource.rb +2 -2
- data/lib/dm-core/spec/setup.rb +1 -1
- data/lib/dm-core/support/lazy_array.rb +4 -4
- data/lib/dm-core/support/logger.rb +1 -1
- data/spec/semipublic/shared/resource_state_shared_spec.rb +4 -4
- metadata +3 -3
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/dm-core.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dm-core}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dan Kubb"]
|
@@ -215,6 +215,7 @@ Gem::Specification.new do |s|
|
|
215
215
|
"tasks/yard.rake",
|
216
216
|
"tasks/yardstick.rake"
|
217
217
|
]
|
218
|
+
s.has_rdoc = %q{yard}
|
218
219
|
s.homepage = %q{http://github.com/datamapper/dm-core}
|
219
220
|
s.rdoc_options = ["--charset=UTF-8"]
|
220
221
|
s.require_paths = ["lib"]
|
@@ -7,19 +7,19 @@ module DataMapper
|
|
7
7
|
OPTIONS = superclass::OPTIONS.dup << :required << :key
|
8
8
|
|
9
9
|
# @api semipublic
|
10
|
-
|
10
|
+
alias_method :source_repository_name, :child_repository_name
|
11
11
|
|
12
12
|
# @api semipublic
|
13
|
-
|
13
|
+
alias_method :source_model, :child_model
|
14
14
|
|
15
15
|
# @api semipublic
|
16
|
-
|
16
|
+
alias_method :target_repository_name, :parent_repository_name
|
17
17
|
|
18
18
|
# @api semipublic
|
19
|
-
|
19
|
+
alias_method :target_model, :parent_model
|
20
20
|
|
21
21
|
# @api semipublic
|
22
|
-
|
22
|
+
alias_method :target_key, :parent_key
|
23
23
|
|
24
24
|
# @api semipublic
|
25
25
|
def required?
|
@@ -64,7 +64,7 @@ module DataMapper
|
|
64
64
|
end
|
65
65
|
|
66
66
|
# @api semipublic
|
67
|
-
|
67
|
+
alias_method :source_key, :child_key
|
68
68
|
|
69
69
|
# Returns a hash of conditions that scopes query that fetches
|
70
70
|
# target object
|
@@ -3,19 +3,19 @@ module DataMapper
|
|
3
3
|
module OneToMany #:nodoc:
|
4
4
|
class Relationship < Associations::Relationship
|
5
5
|
# @api semipublic
|
6
|
-
|
6
|
+
alias_method :target_repository_name, :child_repository_name
|
7
7
|
|
8
8
|
# @api semipublic
|
9
|
-
|
9
|
+
alias_method :target_model, :child_model
|
10
10
|
|
11
11
|
# @api semipublic
|
12
|
-
|
12
|
+
alias_method :source_repository_name, :parent_repository_name
|
13
13
|
|
14
14
|
# @api semipublic
|
15
|
-
|
15
|
+
alias_method :source_model, :parent_model
|
16
16
|
|
17
17
|
# @api semipublic
|
18
|
-
|
18
|
+
alias_method :source_key, :parent_key
|
19
19
|
|
20
20
|
# @api semipublic
|
21
21
|
def child_key
|
@@ -23,7 +23,7 @@ module DataMapper
|
|
23
23
|
end
|
24
24
|
|
25
25
|
# @api semipublic
|
26
|
-
|
26
|
+
alias_method :target_key, :child_key
|
27
27
|
|
28
28
|
# Returns a Collection for this relationship with a given source
|
29
29
|
#
|
@@ -209,7 +209,7 @@ module DataMapper
|
|
209
209
|
# Access Relationship#child_key directly
|
210
210
|
#
|
211
211
|
# @api private
|
212
|
-
|
212
|
+
alias_method :relationship_child_key, :child_key
|
213
213
|
private :relationship_child_key
|
214
214
|
|
215
215
|
# Returns model class used by parent side of the relationship
|
data/lib/dm-core/collection.rb
CHANGED
@@ -97,8 +97,8 @@ module DataMapper
|
|
97
97
|
set_operation(:|, other)
|
98
98
|
end
|
99
99
|
|
100
|
-
|
101
|
-
|
100
|
+
alias_method :|, :union
|
101
|
+
alias_method :+, :union
|
102
102
|
|
103
103
|
# Return the intersection with another collection
|
104
104
|
#
|
@@ -113,7 +113,7 @@ module DataMapper
|
|
113
113
|
set_operation(:&, other)
|
114
114
|
end
|
115
115
|
|
116
|
-
|
116
|
+
alias_method :&, :intersection
|
117
117
|
|
118
118
|
# Return the difference with another collection
|
119
119
|
#
|
@@ -128,7 +128,7 @@ module DataMapper
|
|
128
128
|
set_operation(:-, other)
|
129
129
|
end
|
130
130
|
|
131
|
-
|
131
|
+
alias_method :-, :difference
|
132
132
|
|
133
133
|
# Lookup a Resource in the Collection by key
|
134
134
|
#
|
@@ -367,7 +367,7 @@ module DataMapper
|
|
367
367
|
# the resources directly so that it can orphan them properly.
|
368
368
|
#
|
369
369
|
# @api private
|
370
|
-
|
370
|
+
alias_method :superclass_slice, :slice
|
371
371
|
private :superclass_slice
|
372
372
|
|
373
373
|
# Simulates Array#slice and returns a new Collection
|
@@ -406,7 +406,7 @@ module DataMapper
|
|
406
406
|
end
|
407
407
|
end
|
408
408
|
|
409
|
-
|
409
|
+
alias_method :slice, :[]
|
410
410
|
|
411
411
|
# Deletes and Returns the Resources given by an offset or a Range
|
412
412
|
#
|
@@ -466,7 +466,7 @@ module DataMapper
|
|
466
466
|
resources
|
467
467
|
end
|
468
468
|
|
469
|
-
|
469
|
+
alias_method :splice, :[]=
|
470
470
|
|
471
471
|
# Return a copy of the Collection sorted in reverse
|
472
472
|
#
|
@@ -526,7 +526,7 @@ module DataMapper
|
|
526
526
|
super { |resource| resource_added(yield(resource_removed(resource))) }
|
527
527
|
end
|
528
528
|
|
529
|
-
|
529
|
+
alias_method :map!, :collect!
|
530
530
|
|
531
531
|
# Append one Resource to the Collection and relate it
|
532
532
|
#
|
@@ -690,7 +690,7 @@ module DataMapper
|
|
690
690
|
# Access LazyArray#replace directly
|
691
691
|
#
|
692
692
|
# @api private
|
693
|
-
|
693
|
+
alias_method :superclass_replace, :replace
|
694
694
|
private :superclass_replace
|
695
695
|
|
696
696
|
# Replace the Resources within the Collection
|
@@ -13,8 +13,8 @@ class Pathname
|
|
13
13
|
(self + path).expand_path
|
14
14
|
end
|
15
15
|
|
16
|
-
#
|
16
|
+
# alias_method :to_s, :to to_str when to_str not defined
|
17
17
|
unless public_instance_methods(false).any? { |m| m.to_sym == :to_str }
|
18
|
-
|
18
|
+
alias_method :to_str, :to_s
|
19
19
|
end
|
20
20
|
end # class Pathname
|
data/lib/dm-core/model.rb
CHANGED
@@ -109,7 +109,8 @@ module DataMapper
|
|
109
109
|
create_reader_for(property)
|
110
110
|
create_writer_for(property)
|
111
111
|
|
112
|
-
|
112
|
+
# FIXME: explicit return needed for YARD to parse this properly
|
113
|
+
return property
|
113
114
|
end
|
114
115
|
|
115
116
|
# Gets a list of all properties that have been defined on this Model in
|
data/lib/dm-core/property_set.rb
CHANGED
data/lib/dm-core/query.rb
CHANGED
@@ -430,8 +430,8 @@ module DataMapper
|
|
430
430
|
set_operation(:union, other)
|
431
431
|
end
|
432
432
|
|
433
|
-
|
434
|
-
|
433
|
+
alias_method :|, :union
|
434
|
+
alias_method :+, :union
|
435
435
|
|
436
436
|
# Return the intersection with another query
|
437
437
|
#
|
@@ -447,7 +447,7 @@ module DataMapper
|
|
447
447
|
set_operation(:intersection, other)
|
448
448
|
end
|
449
449
|
|
450
|
-
|
450
|
+
alias_method :&, :intersection
|
451
451
|
|
452
452
|
# Return the difference with another query
|
453
453
|
#
|
@@ -462,7 +462,7 @@ module DataMapper
|
|
462
462
|
set_operation(:difference, other)
|
463
463
|
end
|
464
464
|
|
465
|
-
|
465
|
+
alias_method :-, :difference
|
466
466
|
|
467
467
|
# Clear conditions
|
468
468
|
#
|
@@ -568,7 +568,7 @@ module DataMapper
|
|
568
568
|
dup.slice!(*args)
|
569
569
|
end
|
570
570
|
|
571
|
-
|
571
|
+
alias_method :[], :slice
|
572
572
|
|
573
573
|
# Slices collection by adding limit and offset to the
|
574
574
|
# query, so a single query is executed
|
@@ -88,7 +88,7 @@ module DataMapper
|
|
88
88
|
# @api semipublic
|
89
89
|
attr_reader :operands
|
90
90
|
|
91
|
-
|
91
|
+
alias_method :children, :operands
|
92
92
|
|
93
93
|
# Returns the classes that inherit from AbstractComparison
|
94
94
|
#
|
@@ -232,8 +232,8 @@ module DataMapper
|
|
232
232
|
Operation.new(:or, dup, other.dup).minimize
|
233
233
|
end
|
234
234
|
|
235
|
-
|
236
|
-
|
235
|
+
alias_method :|, :union
|
236
|
+
alias_method :+, :union
|
237
237
|
|
238
238
|
# Return the intersection of the operation and another operand
|
239
239
|
#
|
@@ -248,7 +248,7 @@ module DataMapper
|
|
248
248
|
Operation.new(:and, dup, other.dup).minimize
|
249
249
|
end
|
250
250
|
|
251
|
-
|
251
|
+
alias_method :&, :intersection
|
252
252
|
|
253
253
|
# Return the difference of the operation and another operand
|
254
254
|
#
|
@@ -263,7 +263,7 @@ module DataMapper
|
|
263
263
|
Operation.new(:and, dup, Operation.new(:not, other.dup)).minimize
|
264
264
|
end
|
265
265
|
|
266
|
-
|
266
|
+
alias_method :-, :difference
|
267
267
|
|
268
268
|
# Minimize the operation
|
269
269
|
#
|
data/lib/dm-core/repository.rb
CHANGED
data/lib/dm-core/resource.rb
CHANGED
@@ -254,7 +254,7 @@ module DataMapper
|
|
254
254
|
persisted_state.get(properties[name])
|
255
255
|
end
|
256
256
|
|
257
|
-
|
257
|
+
alias_method :[], :attribute_get
|
258
258
|
|
259
259
|
# Sets the value of the attribute and marks the attribute as dirty
|
260
260
|
# if it has been changed so that it may be saved. Do not set from
|
@@ -295,7 +295,7 @@ module DataMapper
|
|
295
295
|
self.persisted_state = persisted_state.set(properties[name], value)
|
296
296
|
end
|
297
297
|
|
298
|
-
|
298
|
+
alias_method :[]=, :attribute_set
|
299
299
|
|
300
300
|
# Gets all the attributes of the Resource instance
|
301
301
|
#
|
data/lib/dm-core/spec/setup.rb
CHANGED
@@ -116,7 +116,7 @@ class LazyArray # borrowed partially from StrokeDB
|
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
|
-
|
119
|
+
alias_method :slice, :[]
|
120
120
|
|
121
121
|
def slice!(*args)
|
122
122
|
index, length = extract_slice_arguments(*args)
|
@@ -144,7 +144,7 @@ class LazyArray # borrowed partially from StrokeDB
|
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
|
-
|
147
|
+
alias_method :splice, :[]=
|
148
148
|
|
149
149
|
def reverse
|
150
150
|
dup.reverse!
|
@@ -278,7 +278,7 @@ class LazyArray # borrowed partially from StrokeDB
|
|
278
278
|
@array.to_a
|
279
279
|
end
|
280
280
|
|
281
|
-
|
281
|
+
alias_method :to_ary, :to_a
|
282
282
|
|
283
283
|
def load_with(&block)
|
284
284
|
@load_with_proc = block
|
@@ -293,7 +293,7 @@ class LazyArray # borrowed partially from StrokeDB
|
|
293
293
|
super || @array.kind_of?(klass)
|
294
294
|
end
|
295
295
|
|
296
|
-
|
296
|
+
alias_method :is_a?, :kind_of?
|
297
297
|
|
298
298
|
def respond_to?(method, include_private = false)
|
299
299
|
super || @array.respond_to?(method)
|
@@ -2,9 +2,9 @@ share_examples_for 'A method that delegates to the superclass #set' do
|
|
2
2
|
it 'should delegate to the superclass' do
|
3
3
|
# this is the only way I could think of to test if the
|
4
4
|
# superclass method is being called
|
5
|
-
DataMapper::Resource::State.class_eval {
|
5
|
+
DataMapper::Resource::State.class_eval { alias_method :original_set, :set; undef_method(:set) }
|
6
6
|
method(:subject).should raise_error(NoMethodError)
|
7
|
-
DataMapper::Resource::State.class_eval {
|
7
|
+
DataMapper::Resource::State.class_eval { alias_method :set, :original_set; undef_method(:original_set) }
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -12,9 +12,9 @@ share_examples_for 'A method that does not delegate to the superclass #set' do
|
|
12
12
|
it 'should delegate to the superclass' do
|
13
13
|
# this is the only way I could think of to test if the
|
14
14
|
# superclass method is not being called
|
15
|
-
DataMapper::Resource::State.class_eval {
|
15
|
+
DataMapper::Resource::State.class_eval { alias_method :original_set, :set; undef_method(:set) }
|
16
16
|
method(:subject).should_not raise_error(NoMethodError)
|
17
|
-
DataMapper::Resource::State.class_eval {
|
17
|
+
DataMapper::Resource::State.class_eval { alias_method :set, :original_set; undef_method(:original_set) }
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 2
|
9
|
+
version: 1.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Dan Kubb
|
@@ -281,7 +281,7 @@ files:
|
|
281
281
|
- tasks/spec.rake
|
282
282
|
- tasks/yard.rake
|
283
283
|
- tasks/yardstick.rake
|
284
|
-
has_rdoc:
|
284
|
+
has_rdoc: yard
|
285
285
|
homepage: http://github.com/datamapper/dm-core
|
286
286
|
licenses: []
|
287
287
|
|