fossil 0.3.1 → 0.3.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/VERSION +1 -1
- data/fossil.gemspec +1 -1
- data/lib/sequel/model_patch.rb +3 -1
- data/spec/sequel/model_patch_spec.rb +6 -4
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/fossil.gemspec
CHANGED
data/lib/sequel/model_patch.rb
CHANGED
@@ -18,7 +18,9 @@ class Sequel::Model
|
|
18
18
|
# create delegator on the fly
|
19
19
|
method_call = arr.shift
|
20
20
|
arr.each do |next_call|
|
21
|
-
|
21
|
+
unless respond_to? (method_call + "_" + next_call)
|
22
|
+
self.class.delegate next_call.to_sym, :to => method_call.to_sym, :prefix => true, :allow_nil => true
|
23
|
+
end
|
22
24
|
method_call = method_call + "_" + next_call
|
23
25
|
end
|
24
26
|
end
|
@@ -15,16 +15,18 @@ describe "Sequel::Model extentions" do
|
|
15
15
|
Dude.first.fill_hash([:doo]).should == {:doo=>1}
|
16
16
|
end
|
17
17
|
|
18
|
-
describe "recognizes __ in method name" do
|
19
|
-
it "
|
18
|
+
describe "recognizes __ in method name and creates delegators only once" do
|
19
|
+
it "for one level deep" do
|
20
20
|
mock.proxy(Dude).delegate(:name, :to => :my_friend, :prefix => true, :allow_nil => true)
|
21
21
|
Dude.first.fill_hash([:my_friend__name,:my_friend__name]).should == {:my_friend_name=>'dans buddy'}
|
22
22
|
end
|
23
23
|
|
24
|
-
it "
|
24
|
+
it "for two levels deep" do
|
25
|
+
MyFriend.column_alias :kid_date, :'kid - date'
|
25
26
|
mock.proxy(Horse).delegate(:my_friend, :to => :dude, :prefix => true, :allow_nil => true)
|
26
27
|
mock.proxy(Horse).delegate(:name, :to => :dude_my_friend, :prefix => true, :allow_nil => true)
|
27
|
-
Horse.
|
28
|
+
mock.proxy(Horse).delegate(:kid_date, :to => :dude_my_friend, :prefix => true, :allow_nil => true)
|
29
|
+
Horse.first.fill_hash([:dude__my_friend__kid_date,:dude__my_friend__name]).should == {:dude_my_friend_name=>'dans buddy',:dude_my_friend_kid_date=>1}
|
28
30
|
end
|
29
31
|
end
|
30
32
|
end
|