doodle 0.1.0 → 0.1.1
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/History.txt +4 -0
- data/examples/parent.rb +1 -6
- data/lib/doodle.rb +6 -5
- data/lib/doodle/version.rb +1 -1
- data/spec/doodle_context_spec.rb +2 -2
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
== 0.1.1 / 2008-04-28
|
2
|
+
- changed name of #parent to #doodle_parent to avoid clash with
|
3
|
+
ActiveSupport (thanks to Ryan Garver for reporting this)
|
4
|
+
|
1
5
|
== 0.1.0 / 2008-04-26
|
2
6
|
- doodle's first beta version - the API should remain stable from now on
|
3
7
|
- created a Google group: http://groups.google.com/group/ruby-doodle
|
data/examples/parent.rb
CHANGED
@@ -15,13 +15,8 @@ class Child < Doodle
|
|
15
15
|
# - can only be done in init block
|
16
16
|
# - somewhat subtle difference (from programmer's point of
|
17
17
|
# - view) between a proc and a block
|
18
|
-
|
19
|
-
# Also note re: Doodle.parent - its value is only valid
|
20
|
-
# during initialization - this is a way to capture that
|
21
|
-
# value for ues later
|
22
|
-
|
23
18
|
init do
|
24
|
-
|
19
|
+
doodle_parent
|
25
20
|
end
|
26
21
|
end
|
27
22
|
end
|
data/lib/doodle.rb
CHANGED
@@ -235,7 +235,7 @@ class Doodle
|
|
235
235
|
attr_accessor :validation_on
|
236
236
|
attr_accessor :arg_order
|
237
237
|
attr_accessor :errors
|
238
|
-
attr_accessor :
|
238
|
+
attr_accessor :doodle_parent
|
239
239
|
|
240
240
|
def initialize(object)
|
241
241
|
@local_attributes = OrderedHash.new
|
@@ -244,7 +244,7 @@ class Doodle
|
|
244
244
|
@local_conversions = {}
|
245
245
|
@arg_order = []
|
246
246
|
@errors = []
|
247
|
-
@
|
247
|
+
@doodle_parent = nil
|
248
248
|
end
|
249
249
|
real_inspect = Object.instance_method(:inspect)
|
250
250
|
define_method :real_inspect do
|
@@ -831,8 +831,9 @@ class Doodle
|
|
831
831
|
#private :initialize_from_hash
|
832
832
|
|
833
833
|
# return containing object (set during initialization)
|
834
|
-
|
835
|
-
|
834
|
+
# (named doodle_parent to avoid clash with ActiveSupport)
|
835
|
+
def doodle_parent
|
836
|
+
__doodle__.doodle_parent
|
836
837
|
end
|
837
838
|
|
838
839
|
# object can be initialized from a mixture of positional arguments,
|
@@ -843,7 +844,7 @@ class Doodle
|
|
843
844
|
super
|
844
845
|
end
|
845
846
|
__doodle__.validation_on = true
|
846
|
-
__doodle__.
|
847
|
+
__doodle__.doodle_parent = Doodle.context[-1]
|
847
848
|
Doodle.context.push(self)
|
848
849
|
defer_validation do
|
849
850
|
initialize_from_hash(*args)
|
data/lib/doodle/version.rb
CHANGED
data/spec/doodle_context_spec.rb
CHANGED
@@ -20,7 +20,7 @@ describe Doodle, "doodle_context" do
|
|
20
20
|
# during initialization - this is a way to capture that
|
21
21
|
# value for ues later
|
22
22
|
|
23
|
-
init {
|
23
|
+
init { doodle_parent }
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -38,7 +38,7 @@ describe Doodle, "doodle_context" do
|
|
38
38
|
|
39
39
|
sean = dad.children[0]
|
40
40
|
sean.dad.name.should == 'Conn'
|
41
|
-
sean.
|
41
|
+
sean.doodle_parent.name.should == 'Conn'
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doodle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean O'Halpin
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-04-
|
12
|
+
date: 2008-04-28 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|